Last active
August 29, 2015 14:13
-
-
Save zeptometer/1c8a350de2cd9a4720f5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| (import (scheme base) | |
| (scheme write)) | |
| (define hoge 3) | |
| (define-syntax foo | |
| (syntax-rules (hoge) | |
| ((_ hoge) | |
| (write "You got")) | |
| ((_ bar) | |
| (write 'bar)))) | |
| (define-syntax hoo | |
| (er-macro-transformer | |
| (lambda (form r cmp) | |
| (if (cmp (r 'hoge) (cadr form)) | |
| `(,(r 'write) "You got") | |
| `(,(r 'write) ',(cadr form)))))) | |
| (foo hoge) ; got "You got" | |
| (hoo hoge) ; got "You got" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment