[racket] Something to achieve "define-syntax-parameter-for-syntax" or "set!-for-syntax"?

From: Sean Kanaley (skanaley at gmail.com)
Date: Sun Jan 5 13:41:25 EST 2014

*cough* my test cases at the moment amount to pressing the keys and seeing
that the appropriate actions are being taken.  I suppose I will need to
write official tests.


On Sun, Jan 5, 2014 at 1:32 PM, Matthias Felleisen <matthias at ccs.neu.edu>wrote:

>
> It is an unusual way to break syntax but I can't think of a serious
> drawback off the top of my head. (I am sure Ryan and Matthew can think of
> one.) Does it pass your test cases?
>
>
> On Jan 5, 2014, at 1:21 PM, Sean Kanaley wrote:
>
> > Ha!  The below solution is a macro-making macro that re-syntaxifies
> "params ..." to "belong to" the inner macro:
> >
> > (define-syntax-rule (make-commands name params ...)
> >   (define-syntax (name inner-stx)
> >     (syntax-case inner-stx ()
> >       [(_ (c f) (... ...))
> >        (with-syntax ([(ps (... ...)) (datum->syntax inner-stx
> (syntax->datum #'(params ...)))])
> >          #'(list (cons (symbol->string 'c)
> >                        (λ (ps (... ...)) f))
> >                  (... ...)))])))
> >
> > I'm not sure if this is the canonical solution, but nevertheless I think
> it's pretty awesome that this is possible and seems to work.
> > ____________________
> >  Racket Users list:
> >  http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140105/da1d4059/attachment.html>

Posted on the users mailing list.