Signed-off-by: Jim Pryor <profjim@jimpryor.net>
module TC = T.T(C);;
module TS = T.T(S);;
module TR = T.T(R);;
module TC = T.T(C);;
module TS = T.T(S);;
module TR = T.T(R);;
+ let tree = Some (T.Node(T.Leaf '1', T.Node(T.Leaf '2', T.Node(T.Leaf '3', T.Leaf '1'))));;
# let v0 = TC.(run_exn (distribute (fun a ->
C.(shift (fun k -> k a >>= fun v -> unit (1+v)))
) tree)) (fun a -> 0);;
# let v0 = TC.(run_exn (distribute (fun a ->
C.(shift (fun k -> k a >>= fun v -> unit (1+v)))
) tree)) (fun a -> 0);;
# let v1 = TC.(run_exn (distribute (fun a ->
# let v1 = TC.(run_exn (distribute (fun a ->
+ # let annotater : char -> ('x, char) S.m =
+ fun a -> S.(puts (fun s -> (update_env s a)) >> unit a);;
# let v2 = TS.(run (distribute annotater tree)) (fun a -> 0);;
# let v2 = TS.(run (distribute annotater tree)) (fun a -> 0);;
- # let (tree',env) = v2 in TR.(run (distribute (fun a -> a) tree')) env;;
+ # let (t, env) = v2 in TR.(run (distribute (fun a -> R.asks (fun e -> e a)) t)) env;;
(* returns tree with leafs replaced with their numbers of occurrences *)
(* returns tree with leafs replaced with their numbers of occurrences *)