???
This commit is contained in:
parent
b723750417
commit
6c5aa26491
@ -70,7 +70,7 @@
|
||||
(test/exn (lookup 'x mt-env) "not bound")
|
||||
|
||||
; Needs to return new environment, with the boxed value containing the function, and a recursive reference to the same environment
|
||||
(define (extend-rec [env : Env] [sym : Symbol] [exp : Exp])
|
||||
(define (extend-rec env sym exp)
|
||||
(local [(define self (extend env sym (funV sym exp env)))]
|
||||
(type-case (Optionof (Boxof Value)) (hash-ref self sym)
|
||||
[(none) self]
|
||||
@ -104,11 +104,11 @@
|
||||
(interp b (extend f-env v av))] ;; changed
|
||||
[else (error 'app "not a function")]))]
|
||||
[(let1E var val body)
|
||||
(let ([new-env (extend nv
|
||||
var
|
||||
(interp val nv))])
|
||||
(let ([new-env (extend nv var (interp val nv))])
|
||||
(interp body new-env))]
|
||||
[(recE var val body) ....]))
|
||||
[(recE var val body)
|
||||
(let ([rec-env (extend-rec nv var val)])
|
||||
(interp body rec-env))]))
|
||||
|
||||
(run : (S-Exp -> Value))
|
||||
(define (run s)
|
||||
|
Loading…
x
Reference in New Issue
Block a user