[racket] Something to achieve "define-syntax-parameter-for-syntax" or "set!-for-syntax"?
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140105/7f2dee9d/attachment.html>