xapon
0 Likes Commentstext
;mlet - (struct mlet (var e body) #:transparent)
[(mlet? e)
(letrec ([v (eval-under-env (mlet-e e) env)]
[new-env (cons (cons (mlet-var e) v) env)])
(eval-under-env (mlet-body e) new-env))]
;fun -(struct fun (nameopt formal body) #:transparent)
[(fun? e)
(if (and (string? (fun-nameopt e)) (string? (fun-formal e)))
(letrec ([new-env (cons (cons (fun-nameopt e) e) env)])
(closure new-env e))
(if (and (false? (fun-nameopt e)) (string? (fun-formal e)))
(closure env e)
(error "bad parameters passed to function")))]
;closure - (struct closure (env fun) #:transparent)
[(closure? e) e]