summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e948c27)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
# let tree_reader = TR.distribute (fun i -> R.asks (fun e -> e i)) t1;;
# TR.run tree_reader (fun i -> i+i);;
# let tree_reader = TR.distribute (fun i -> R.asks (fun e -> e i)) t1;;
# TR.run tree_reader (fun i -> i+i);;
- : int T.tree option =
Some
(T.Node
(T.Node (T.Leaf 4, T.Leaf 6),
T.Node (T.Leaf 10, T.Node (T.Leaf 14, T.Leaf 22))))
- : int T.tree option =
Some
(T.Node
(T.Node (T.Leaf 4, T.Leaf 6),
T.Node (T.Leaf 10, T.Node (T.Leaf 14, T.Leaf 22))))
Here's a comparison of how distribute works for trees and how it works for lists:
Here's a comparison of how distribute works for trees and how it works for lists:
# let tree_counter = TS.distribute (fun i -> S.(puts succ >> unit i)) t1 in
TS.run tree_counter 0;;
# let tree_counter = TS.distribute (fun i -> S.(puts succ >> unit i)) t1 in
TS.run tree_counter 0;;
- : int T.tree option * S.store =
(Some
(T.Node
(T.Node (T.Leaf 2, T.Leaf 3),
T.Node (T.Leaf 5, T.Node (T.Leaf 7, T.Leaf 11)))),
5)
- : int T.tree option * S.store =
(Some
(T.Node
(T.Node (T.Leaf 2, T.Leaf 3),
T.Node (T.Leaf 5, T.Node (T.Leaf 7, T.Leaf 11)))),
5)