[racket] Basic Questions Regarding Macros

From: Todd Bittner (toddbittner at gmail.com)
Date: Wed Aug 31 13:41:18 EDT 2011


I'm a newcomer to Racket, and, so far, I love it.  The language is a joy,
and the documentation is well-written, but I find myself struggling a bit
with the section in The Guide on macros.

In regards to syntax-rules and syntax-id-rules there is 'literal-id'
parameter that I don't understand.  In the syntax-rules example with rotate,
it's left blank, but in the syntax-id-rules example with clock, it's
populated with 'set!'.  What specific purpose does this serve?  It seems to
me that the syntax for set! would be matched in the pattern below 'set!
clock e', so I don't know what other information it imparts.

Also, syntax-id-rules seems to be used, as stated in the documentation, for
cases where the macro form won't follow an open parenthesis, and when using
set!.  I know that set! is a special mutator function, but it seems strange
to me that one function has an entirely special case.

Finally, reading through the reference, #' serves, I believe, as shorthand
for (syntax), but in what practical situations would I then call it?

Thanks for the help,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110831/1c4611df/attachment.html>

Posted on the users mailing list.