[gambit-list] Intermixing syntax-rules and define-macro
Mikael
mikael.rcv at gmail.com
Thu Sep 27 19:45:02 EDT 2012
Black Hole provides this with an pretty-much-as-well-as-can-be-done quality.
2012/9/28 Patrick Li <patrickli.2001 at gmail.com>
> 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
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120928/ed33593f/attachment.htm>
More information about the Gambit-list
mailing list