Fix module syntax; should be (define ...), not (declare ...).
This commit is contained in:
parent
723f52dc1d
commit
8318db755f
|
|
@ -5,17 +5,17 @@
|
||||||
(provide read-module)
|
(provide read-module)
|
||||||
|
|
||||||
(define (read-module [port (current-input-port)])
|
(define (read-module [port (current-input-port)])
|
||||||
`(lambda argv
|
`(lambda *argv*
|
||||||
,@(let iter ([forms (read-forms port)]
|
,@(let iter ([forms (read-forms port)]
|
||||||
[bindings '()])
|
[bindings '()])
|
||||||
(cond
|
(cond
|
||||||
[(null? forms) (if (null? bindings)
|
[(null? forms) (if (null? bindings)
|
||||||
'()
|
'()
|
||||||
`(letrec ,bindings))]
|
`(letrec ,bindings))]
|
||||||
[(simple-declare-form? (first forms))
|
[(simple-define-form? (first forms))
|
||||||
(iter (cdr forms) (cons (cdr (first forms))
|
(iter (cdr forms) (cons (cdr (first forms))
|
||||||
bindings))]
|
bindings))]
|
||||||
[(lambda-declare-form? (first forms))
|
[(lambda-define-form? (first forms))
|
||||||
(iter (cdr forms) (cons `(,(first (second (first forms)))
|
(iter (cdr forms) (cons `(,(first (second (first forms)))
|
||||||
(lambda ,(cdr (second (first forms)))
|
(lambda ,(cdr (second (first forms)))
|
||||||
,@(cddr (first forms))))
|
,@(cddr (first forms))))
|
||||||
|
|
@ -34,15 +34,15 @@
|
||||||
forms
|
forms
|
||||||
(iter (read port) (cons form forms))))))
|
(iter (read port) (cons form forms))))))
|
||||||
|
|
||||||
(define (simple-declare-form? form)
|
(define (simple-define-form? form)
|
||||||
(and (pair? form)
|
(and (pair? form)
|
||||||
(eq? (first form) 'declare)
|
(eq? (first form) 'define)
|
||||||
(symbol? (second form))
|
(symbol? (second form))
|
||||||
(null? (cdddr form))))
|
(null? (cdddr form))))
|
||||||
|
|
||||||
(define (lambda-declare-form? form)
|
(define (lambda-define-form? form)
|
||||||
(and (pair? form)
|
(and (pair? form)
|
||||||
(eq? (first form) 'declare)
|
(eq? (first form) 'define)
|
||||||
(pair? (second form))
|
(pair? (second form))
|
||||||
(symbol? (first (second form)))))
|
(symbol? (first (second form)))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue