tweak calc improvements
authorJim Pryor <profjim@jimpryor.net>
Fri, 26 Nov 2010 03:43:55 +0000 (22:43 -0500)
committerJim Pryor <profjim@jimpryor.net>
Fri, 26 Nov 2010 03:43:55 +0000 (22:43 -0500)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
advanced_topics/calculator_improvements.mdwn
code/calculator/calc4.ml

index 280604f..b36f628 100644 (file)
@@ -448,12 +448,12 @@ Now we need to formulate the clauses for evaluating the new forms `Newref (...)`
 
        ...
        | Newref (t1) ->
 
        ...
        | Newref (t1) ->
-               let (starting_val, s') = eval t1 g s
+               let (value1, s') = eval t1 g s
                (* note that s' may be different from s, if t1 itself contained any mutation operations *)
                (* now we want to retrieve the next free index in s' *)
                in let new_index = List.length s'
                (* note that s' may be different from s, if t1 itself contained any mutation operations *)
                (* now we want to retrieve the next free index in s' *)
                in let new_index = List.length s'
-               (* now we want to insert starting_val there; the following is an easy but inefficient way to do it *)
-               in let s'' = List.append s' [starting_val]
+               (* now we want to insert value1 there; the following is an easy but inefficient way to do it *)
+               in let s'' = List.append s' [value1]
                (* now we return a pair of a wrapped new_index, and the new store *)
                in (Mutcell new_index, s'')
        | Deref (t1) ->
                (* now we return a pair of a wrapped new_index, and the new store *)
                in (Mutcell new_index, s'')
        | Deref (t1) ->
index a04587b..27687d5 100644 (file)
         in let g' = (var_to_bind, Recursive_Closure (var_to_bind, arg_var, body, savedg)) :: g
         in eval t3 g' s'
     | Newref (t1) ->
         in let g' = (var_to_bind, Recursive_Closure (var_to_bind, arg_var, body, savedg)) :: g
         in eval t3 g' s'
     | Newref (t1) ->
-        let (starting_val, s') = eval t1 g s
+        let (value1, s') = eval t1 g s
         (* note that s' may be different from s, if t1 itself contained any mutation operations *)
         (* now we want to retrieve the next free index in s' *)
         in let new_index = List.length s'
         (* note that s' may be different from s, if t1 itself contained any mutation operations *)
         (* now we want to retrieve the next free index in s' *)
         in let new_index = List.length s'
-        (* now we want to insert starting_val there; the following is an easy but inefficient way to do it *)
-        in let s'' = List.append s' [starting_val]
+        (* now we want to insert value1 there; the following is an easy but inefficient way to do it *)
+        in let s'' = List.append s' [value1]
         (* now we return a pair of a wrapped new_index, and the new store *)
         in (Mutcell new_index, s'')
     | Deref (t1) ->
         (* now we return a pair of a wrapped new_index, and the new store *)
         in (Mutcell new_index, s'')
     | Deref (t1) ->