guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Please explain different macros


From: Dale P. Smith
Subject: Please explain different macros
Date: Thu, 19 Apr 2001 13:20:30 -0400

Could someone please explain (in plain english) the differences between
the 3 different kinds of "native" macros that Guile supports.  As
opposed to the system in r5rs?  We have acro, macro and mmacro.

Here is the docs for "procedure->macro":
            "Return a @dfn{macro} which, when a symbol defined to this
value\n"
            "appears as the first symbol in an expression, evaluates
the\n"
            "result of applying @var{code} to the expression and the\n"
            "environment.  The value returned from @var{code} which has
been\n"
            "passed to @code{procedure->memoizing-macro} replaces the
form\n"
            "passed to @var{code}.  For example:\n"
            "\n"
            "@lisp\n"
            "(define trace\n"
            "  (procedure->macro\n"
            "   (lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x)
',(cadr x))))
            "(trace @i{foo}) @equiv{} (set! @i{foo} (tracef @i{foo}
'@i{foo})).\
            "@end lisp"

And for "procedure->memorizing-macro":
            "Return a @dfn{macro} which, when a symbol defined to this
value\n"
            "appears as the first symbol in an expression, evaluates
the\n"
            "result of applying @var{proc} to the expression and the\n"
            "environment.  The value returned from @var{proc} which has
been\n"
            "passed to @code{procedure->memoizing-macro} replaces the
form\n"
            "passed to @var{proc}.  For example:\n"
            "\n"
            "@lisp\n"
            "(define trace\n"
            "  (procedure->macro\n"
            "   (lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x)
',(cadr x))))
            "(trace @i{foo}) @equiv{} (set! @i{foo} (tracef @i{foo}
'@i{foo})).\
            "@end lisp"

It's a bit hard for me to tell what's going on.

Thanks!
  -Dale

-- 
Dale P. Smith
Treasurer, Cleveland Linux Users Group http://cleveland.lug.net
Senior Systems Consultant, Altus Technologies Corporation
address@hidden
440-746-9000 x309



reply via email to

[Prev in Thread] Current Thread [Next in Thread]