[plt-scheme] syntax-parameterize

From: Felix Klock's PLT scheme proxy (pltscheme at pnkfx.org)
Date: Wed May 3 14:42:21 EDT 2006


I just looked at the syntax-parameterize example you gave to Danny  
back in April on the plt-scheme mailing list:

(define-syntax define-generator
     (syntax-rules ()
       [(define-generator (name . args) . body)
        (define (name . args)
          (let ([name
                 (lambda (yielder)
                          (syntax-rules ()
                            [(yield value)
                             (yielder value)])])
                     . body))])
            (make-generator name)))]))

One common pattern with "normal" parameters is to use an expression  
that refers back to their old value when you change them with a  
parameterize form; the new value is only installed for the body of  
the parameterize (or something along those lines; I don't know if the  
semantics of parameterize are analogous to LET, or to LET*... I  
assume LET...)

Can one get a similar effect with syntax-parameters?  It seems like  
it would be a useful thing to do at times, in order to augment  
behavior rather than completely replace it.

I suppose it is impossible to make an example of such usage with  
standard syntax-rules, but maybe you can make a simple syntax-case  
example that I'll grok.  :)

(I tried to answer my question by looking up syntax-parameterize in  
the docs at
but did not find any mention of the construct there... it's not part  
of a planet package, is it?)


Posted on the users mailing list.