File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,7 +76,6 @@ module Make(O:Set.OrderedType) : S with type key = O.t =
7676
7777 let pp_str pp_bind m = pp_str_delim " ;" pp_bind m
7878
79-
8079 let pp chan pp_bind m =
8180 iter
8281 (fun k v -> pp_bind chan k v ; fprintf chan " ;" )
@@ -86,14 +85,7 @@ module Make(O:Set.OrderedType) : S with type key = O.t =
8685
8786 let union_std = union
8887
89- let union u m1 m2 =
90- fold
91- (fun k v1 m ->
92- try
93- let v2 = find k m2 in
94- add k (u v1 v2) m
95- with Not_found -> add k v1 m)
96- m1 m2
88+ let union u m1 m2 = union_std (fun _ v1 v2 -> Some (u v1 v2)) m1 m2
9789
9890 let unions u ms = match ms with
9991 | [] -> empty
@@ -111,7 +103,10 @@ module Make(O:Set.OrderedType) : S with type key = O.t =
111103 fun t acc -> fold fold_binding t acc
112104
113105 let accumulate k v m =
114- let vs = safe_find [] k m in
115- add k (v::vs) m
106+ update k
107+ (function
108+ | None -> Some [v]
109+ | Some vs -> Some (v::vs))
110+ m
116111
117112 end
You can’t perform that action at this time.
0 commit comments