X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fptset.ml;h=08332b3cbb03783c1f3ba17a3fae0d2be664aa83;hp=87ca2a5e81cfc12d18484fcfdd92a9310c41498e;hb=a601c67e92d85f7096db693e4fde86950be598c6;hpb=aade6d9ba2e2b65e021de8a1c3a2d3874aa5742e diff --git a/src/ptset.ml b/src/ptset.ml index 87ca2a5..08332b3 100644 --- a/src/ptset.ml +++ b/src/ptset.ml @@ -289,11 +289,17 @@ struct | Leaf k -> f k | Branch (_,_,t0,t1) -> iter f t0; iter f t1 - let rec fold f s accu = match s.Node.node with + let rec fold_left f s accu = match s.Node.node with | Empty -> accu | Leaf k -> f k accu - | Branch (_,_,t0,t1) -> fold f t1 (fold f t0 accu) + | Branch (_,_,t0,t1) -> fold_left f t1 (fold_left f t0 accu) + let rec fold_right f s accu = match s.Node.node with + | Empty -> accu + | Leaf k -> f k accu + | Branch (_,_,t0,t1) -> fold_right f t0 (fold_right f t1 accu) + + let fold f s accu = fold_left f s accu let rec for_all p n = match n.Node.node with | Empty -> true