Created
October 15, 2012 16:32
-
-
Save deeglaze/3893452 to your computer and use it in GitHub Desktop.
A better define-syntax-rule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require (for-syntax syntax/parse)) | |
; syntax classes, syntax-parse patterns and unquote-syntax in your define-syntax-rule! | |
(define-syntax (define-syntax-rule* stx) | |
(syntax-parse stx | |
[(_ (name patterns ...) body ...) | |
(syntax/loc stx | |
(define-syntax (name syn) | |
(syntax-parse syn | |
[(_ patterns ...) | |
(quasisyntax/loc syn (begin body ...))])))])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment