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);;
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.