On Apr 25, 2016, at 3:08 PM, Alexis King <[email protected]> wrote:
>
> Even more generally, if you want macros to compose in a more arbitrary
> and less structured way, you can call local-expand from the containing
> macro in order to “flip” evaluation order as I believe you described
> in your original message.
I tried that but got hung up on the "identifier tainted by macro expansion"
error. But after some experimentation I see that `syntax-disarm` will cure
this. Thus the answer to my original question about what `magic-goes-here`:
;;;;;;;;;;;;;;;;;;
#lang racket
(define-syntax-rule (id-maker _a "," _b "," _c)
(_a _b _c))
(define-syntax (binding-form stx)
(syntax-case stx ()
[(_ _topid inside-macro)
(with-syntax ([(_id ...) (syntax-disarm
(local-expand #'inside-macro
'expression
#f) #f)])
#'(begin
(provide _topid)
(define (_topid)
(let ([_id (random)] ...)
(displayln (format "~a bound ~a with value ~a" '_topid '_id _id))
...))))]))
(binding-form foo (a b c))
(foo) ; works
(binding-form bar (id-maker d "," e "," f))
(bar) ; works
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.