<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16434"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=303341819-31082011><FONT color=#0000ff
size=2 face=Arial>The literals are there to make sure that a given identifier in
a macro call has the same binding as asumed by the macro
itself.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=303341819-31082011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=303341819-31082011><FONT color=#0000ff
size=2 face=Arial>Ezample:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=303341819-31082011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=303341819-31082011><FONT color=#0000ff
size=2 face=Arial>#lang racket<BR>(define-syntax is-a?<BR> (syntax-rules
(a)<BR> ((_ a) 'yes)<BR> ((_ _)
'no)))</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=303341819-31082011><FONT color=#0000ff
size=2 face=Arial>(define a 'whatever)</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><SPAN class=303341819-31082011><FONT color=#0000ff
size=2 face=Arial>(is-a? a) ; yes<BR>(let ((a 'something-else)) (is-a? a)) ;
no</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=303341819-31082011></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=303341819-31082011><FONT color=#0000ff
size=2 face=Arial>Jos</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> users-bounces@racket-lang.org
[mailto:users-bounces@racket-lang.org] <B>On Behalf Of </B>Todd
Bittner<BR><B>Sent:</B> miércoles, 31 de agosto de 2011 19:41<BR><B>To:</B>
users@racket-lang.org<BR><B>Subject:</B> [racket] Basic Questions Regarding
Macros<BR></FONT><BR></DIV>
<DIV></DIV>Hi, <BR><BR>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.<BR><BR>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.<BR><BR>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.<BR><BR>Finally, reading through the reference, #' serves, I believe, as
shorthand for (syntax), but in what practical situations would I then call
it?<BR><BR>Thanks for the help,<BR><BR>Todd <BR></BODY></HTML>