(map normalize (let-body prog))))
(else prog)))
+(define (builtin-type x)
+ (case x
+ ('+ '(abs int (abs int int)))
+ ('- '(abs int (abs int int)))
+ ('* '(abs int (abs int int)))
+ ('! '(abs bool bool))
+ ('bool->int '(abs bool int))
+ (else #f)))
; we typecheck the lambda calculus only (only single arg lambdas)
(define (typecheck prog)
(cond
((integer? x) (list '() 'int))
((boolean? x) (list '() 'bool))
- ((eq? x 'inc) (list '() '(abs int int)))
- ((eq? x '+) (list '() '(abs int (abs int int))))
+ ((builtin-type x) (list '() (builtin-type x)))
((symbol? x) (list '() (env-lookup env x)))
-
((let? x)
(let ((new-env (fold-left
(lambda (acc bind)