3 ms·
First, you don't need `w/uniq' in Racket - hygenic macros do that for you automatically. Here's `swap' in Racket: (define-syntax-rule (swap a b) (let ([
by samth 16y ago
First, you don't need `w/uniq' in Racket - hygenic macros do that for you automatically. Here's `swap' in Racket:
(define-syntax-rule (swap a b)
(let ([tmp a]) (set! a b) (set! b tmp)))
But if you wanted to implement it, here's an easy way to do it in the same module
(define-syntax (swap stx)
(define-syntax (w/uniq stx) ...)
(syntax-parse stx
[(swap a b) ...]))
That said, the fact that you can't define macros to be used in macros in the same file can be annoying, and is something that we plan to add to the language.