- | Lambda (arg_var, t2) -> (Closure (arg_var, t2, g), s)
- | Apply (t1, t2) ->
- (* we don't handle cases where t1 doesn't evaluate to a function value *)
- let (Closure (arg_var, body, savedg), s') = eval t1 g s
- in let (value2, s'') = eval t2 g s'
- (* evaluate body under savedg, except with arg_var bound to Nonrecursive value2 *)
- in let savedg' = (arg_var, Nonrecursive value2) :: savedg
- in eval body savedg' s''
- | Letrec (var_to_bind, t2, t3) ->
- (* we don't handle cases where t2 doesn't evaluate to a function value *)
- let (Closure (arg_var, body, savedg), s') = eval t2 g s
+ | Lambda (arg_var, t2) -> (Closure (arg_var, t2, g), s)
+ | Apply (t1, t2) ->
+ (* we don't handle cases where t1 doesn't evaluate to a function value *)
+ let (Closure (arg_var, body, savedg), s') = eval t1 g s
+ in let (value2, s'') = eval t2 g s'
+ (* evaluate body under savedg, except with arg_var bound to Nonrecursive value2 *)
+ in let savedg' = (arg_var, Nonrecursive value2) :: savedg
+ in eval body savedg' s''
+ | Letrec (var_to_bind, t2, t3) ->
+ (* we don't handle cases where t2 doesn't evaluate to a function value *)
+ let (Closure (arg_var, body, savedg), s') = eval t2 g s