[gambit-list] Intermixing syntax-rules and define-macro
Patrick Li
patrickli.2001 at gmail.com
Thu Sep 27 18:34:45 EDT 2012
Hello,
I am having some issues with the subtleties of the low-level define-macro
system. The problem seems to be that the identifiers created by
syntax-rules are not equivalent to the identifiers created by define-macro.
I would really appreciate some help on this.
Here is a small example:
(define-syntax multi-let
(syntax-rules ()
((multi-let (vars ...) body ...)
(let* [(vars '()) ...] ;; Declare the variables
($set vars) ... ;; Set them to "initial"
body ...))))
(define-macro ($set var)
`(set! ,var "initial")) ;; Set the variable to "initial"
And here is what happens when I try to use it:
> (multi-let (x y z) x)
*** ERROR IN #<procedure #2> -- Unbound variable: x
Thank you very much! For my use case, I am unable to stick completely to
using define-syntax thus have to deal with how to intermix these two
systems properly.
-Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120927/8a23800c/attachment.htm>
More information about the Gambit-list
mailing list