-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathinput-parse.sch
27 lines (27 loc) · 971 Bytes
/
input-parse.sch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
; Top-level cond-expand expanded automatically
(define-macro (define-opt bindings body . body-rest)
(let* ((rev-bindings (reverse bindings))
(opt-bindings
(and (pair? rev-bindings)
(pair? (car rev-bindings))
(eq? 'optional (caar rev-bindings))
(cdar rev-bindings))))
(if opt-bindings
`(define (unquote
(append
(reverse
(cons
(with-input-from-string "#!optional" read)
(cdr rev-bindings)))
opt-bindings))
,body
,@body-rest)
`(define ,bindings ,body ,@body-rest))))
; Top-level cond-expand expanded automatically
(define-macro (gambitize clause)
`(define-macro ,clause
,(list
'quasiquote
(cons
(string->symbol (string-append "##" (symbol->string (car clause))))
(map (lambda (id) (list 'unquote id)) (cdr clause))))))