Ticket #1832: define-alist.scm
| File define-alist.scm, 482 bytes (added by , 13 days ago) |
|---|
| Line | |
|---|---|
| 1 | (define-syntax define-alist-macro |
| 2 | (syntax-rules () |
| 3 | ((_ name (ids ...)) |
| 4 | (define-alist-macro "generate" name (ids ...) ())) |
| 5 | ((_ "generate" name (id ids ...) (acc ...)) |
| 6 | (define-alist-macro "generate" name (ids ...) ((cons id tmp) acc ...))) |
| 7 | ((_ "generate" name () ((cons id tmp) ...)) |
| 8 | (define-syntax name |
| 9 | (syntax-rules ...* () |
| 10 | ((_ tmp ...) (list (cons (quote id) tmp) ...))))))) |
| 11 | (define-alist-macro test (a b c d)) |
| 12 | (display (test 4 3 2 1)) |
