Created
April 19, 2011 15:34
-
-
Save draftcode/928479 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
| (define-syntax l | |
| (syntax-rules () | |
| ((_ P Q ...) (lambda (P) Q ...)))) | |
| (define c 1) | |
| (define-syntax macro | |
| (syntax-rules () | |
| ((_ P) ((l c (list c P)) c)))) | |
| (let1 c 2 (macro c)) ; => '(1 2) | |
| ; This macro expansion is wrong. | |
| ; -> ((l c (list c c)) c) => '(2 2) | |
| ; To avoid this expansion, we should expand this form as below. | |
| ; -> ((l c0 (list c0 c)) 1) | |
| ; -> ((lambda (c0) (list c0 c)) 1) => '(1 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment