expand
parse
symtab
+ type-of
∷))
(define symtab '())
`(lambda (,var) ,bodye)))))
(('letrecc1 ((? symbol? name) expr) body)
(type-error 0 'letrecc1 name expr body))
+ (('definec (? (lambda (x)
+ (and
+ (pair? x)
+ (symbol? (car x))
+ (var-list? (cdr x))))
+ (name vars ..1))
+ body)
+ (expand
+ symtab
+ `(definec ,name
+ ,(fold-right (lambda (x prev)
+ `(λc ,x ,prev))
+ body vars))))
+ (('definec (? symbol? name) body)
+ (let ((t e (expand symtab body)))
+ (if (not t)
+ (type-error 5 "in body of" `(definec ,name ,body))
+ (begin
+ (∷% name t)
+ (values
+ #f
+ `(define ,name ,e))))))
((f)
(let ((t e (expand symtab f)))
(values
(define-syntax-rule (∷ name type)
(∷% 'name (parse 'type)))
+
+(define (type-of x)
+ (pt (assoc-ref symtab x)))