X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=hints%2Fassignment_7_hint_3.mdwn;h=be018dede8da5794f671a64e938faaaec1409115;hp=0914b79d3c2bd6e2361aa80e45b0850027889b16;hb=1b40bc7e0915e247ecaa6ea9d583b26790c31a74;hpb=679852d7a5f67d6da3443b959acb1a41f3558c85 diff --git a/hints/assignment_7_hint_3.mdwn b/hints/assignment_7_hint_3.mdwn index 0914b79d..be018ded 100644 --- a/hints/assignment_7_hint_3.mdwn +++ b/hints/assignment_7_hint_3.mdwn @@ -33,15 +33,15 @@ It will be useful to have a shorthand way of referring to this operation: let new_peg_and_assign (var_to_bind : char) (d : entity) = fun ((r, h) : assignment * store) -> (* first we calculate an unused index *) - let newindex = List.length h - (* next we store d at h[newindex], which is at the very end of h *) + let new_index = List.length h + (* next we store d at h[new_index], which is at the very end of h *) (* the following line achieves that in a simple but inefficient way *) in let h' = List.append h [d] - (* next we assign 'x' to location newindex *) - in let r' = fun v -> - if v = var_to_bind then newindex else r v + (* next we assign 'x' to location new_index *) + in let r' = fun var -> + if var = var_to_bind then new_index else r var (* the reason for returning true as an initial element will emerge later *) - in (true, r',h') + in (true, r', h') -* Is that enough? If not, here are some [more hints](/hints/assignment_7_hint_4). +* Is that enough? If not, here are some [more hints](/hints/assignment_7_hint_4). But try to get as far as you can on your own.