On Jul 12, 2011, at 6:41 AM, Maurizio Giordano wrote: > Hi Matthias, hi schemers, > > 2011/7/11 Matthias Felleisen <matth...@ccs.neu.edu> > > Now I don't understand at all why you want to use eval in the macro. > If the right-hand side just returned the lambda that you have there, > it would automatically capture the variables in the context of the > gama rule. > > > Have you tried just returning the lambda as is from the macro? > > I tried but it doesn't work! Here you find a sample of what you suggest: > --------------- > (define-syntax mymacro > (syntax-rules (prova) > [(mymacro input ...) > (lambda (z) (list input ...) (+ z extern-var))])) > > > (let* ((extern-var 2) (f (mymacro x y))) (f 1)) > reference to undefined identifier: extern-var
Here is what I meant: #lang racket (define-syntax-rule (mm x) (lambda (w) (displayln `(,x)) (+ w x))) (define f (let ([a 10]) (mm a))) (f 42) More later -- Matthias
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users