X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=code%2Fcalculator%2Fcalc4.ml;h=54519f0c6121f0630d1da925374e49dfcb526960;hp=27687d57b9be0a1fc986e5266eecbcd5d10bc4d4;hb=060198e29e2a13552ee64c1e489eea555c8b1cae;hpb=ee6e8e390ac5ffa57dc95531939222efda5d37ff diff --git a/code/calculator/calc4.ml b/code/calculator/calc4.ml index 27687d57..54519f0c 100644 --- a/code/calculator/calc4.ml +++ b/code/calculator/calc4.ml @@ -105,12 +105,12 @@ (* we don't handle cases where t1 doesn't evaluate to a Mutcell *) let (Mutcell index1, s') = eval t1 g s (* note that s' may be different from s, if t1 itself contained any mutation operations *) - in let (new_value, s'') = eval t2 g s' - (* now we create a list which is just like s'' except it has new_value in index1 *) + in let (value2, s'') = eval t2 g s' + (* now we create a list which is just like s'' except it has value2 in index1 *) in let rec replace_nth lst m = match lst with | [] -> failwith "list too short" - | x::xs when m = 0 -> new_value :: xs + | x::xs when m = 0 -> value2 :: xs | x::xs -> x :: replace_nth xs (m - 1) in let s''' = replace_nth s'' index1 (* we'll arbitrarily return Int 42 as the expressed_value of a Setref operation *)