- ...
- | Let (var_to_bind, t2, t3) ->
- let (value2, s') = eval t2 g s
- (* note that s' may be different from s, if t2 itself contained any mutation operations *)
- (* get next free index in s' *)
- in let new_index = List.length s'
- (* now we want to insert value2 there; the following is an easy but inefficient way to do it *)
- in let s'' = List.append s' [value2]
- (* bind var_to_bind to location new_index in the store *)
- in let g' = ((var_to_bind, new_index) :: g)
- in eval t3 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 a new location containing value2 *)
- in let new_index = List.length s''
- in let s''' = List.append s'' [value2]
- in let savedg' = (arg_var, new_index) :: savedg
- in eval body savedg' s'''
- ...
+ ...
+ | Let (var_to_bind, t2, t3) ->
+ let (value2, s') = eval t2 g s
+ (* note that s' may be different from s, if t2 itself contained any mutation operations *)
+ (* get next free index in s' *)
+ in let new_index = List.length s'
+ (* now we want to insert value2 there; the following is an easy but inefficient way to do it *)
+ in let s'' = List.append s' [value2]
+ (* bind var_to_bind to location new_index in the store *)
+ in let g' = ((var_to_bind, new_index) :: g)
+ in eval t3 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 a new location containing value2 *)
+ in let new_index = List.length s''
+ in let s''' = List.append s'' [value2]
+ in let savedg' = (arg_var, new_index) :: savedg
+ in eval body savedg' s'''
+ ...