Black Hole provides this with an pretty-much-as-well-as-can-be-done quality.

2012/9/28 Patrick Li <patrickli.2001@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@iro.umontreal.ca
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list