X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=hints%2Fassignment_10_hint_2.mdwn;h=279c279d6be38cb1a460c26f2163f11f7e8538d1;hp=9bb1cd66c8d67e3b84cc835021f205f2b9175a74;hb=9b5f91f462e9f64944ce2aa95ab3f8d30371a469;hpb=399197e0af7c4b80f326be60ff2c0caae74b3687 diff --git a/hints/assignment_10_hint_2.mdwn b/hints/assignment_10_hint_2.mdwn index 9bb1cd66..279c279d 100644 --- a/hints/assignment_10_hint_2.mdwn +++ b/hints/assignment_10_hint_2.mdwn @@ -28,7 +28,8 @@ of each value, rather than how many leaves in total: let update_env e x = fun y -> (if x = y then 1 else 0) + e y;; - let v1 = TreeCont.monadize (fun a k e0 -> + let v1 = TreeCont.monadize (fun a k -> + fun e0 -> let ecur = k a e0 in update_env ecur a ) tree (fun t e -> e) (fun a -> 0);; @@ -39,7 +40,7 @@ of each value, rather than how many leaves in total: v1 '2' ~~> 1 *) -How does this work? Our distributed function `fun a k e -> ...` takes a leaf element `a` and a continuation `k`, which maps leaf elements and environments `e0` to new environments `ecur`. It gives back a function from `e0` to an updated version of `ecur`. +How does this work? Our distributed function `fun a k -> ...` takes a leaf element `a` and a continuation `k`, which maps leaf elements and environments `e0` to new environments `ecur`. It gives back a function from `e0` to an updated version of `ecur`. Our seed function here is the initial continuation. Instead of taking a leaf element and an env, it takes a tree of such elements and an env. In general, wherever the distributed function takes `'a`s, the seed function takes `'a tree`s.