Commit 6eecaae1 authored by POTTIER Francois's avatar POTTIER Francois

Added [Atom.Set.union_many].

parent 983ff33f
...@@ -144,6 +144,13 @@ module Set = struct ...@@ -144,6 +144,13 @@ module Set = struct
let disjoint xs ys = let disjoint xs ys =
is_empty (inter xs ys) is_empty (inter xs ys)
(* Iterated union. *)
let union_many (f : 'a -> t) (xs : 'a list) : t =
List.fold_left (fun accu x ->
union accu (f x)
) empty xs
(* Disjoint union. *) (* Disjoint union. *)
exception NonDisjointUnion of atom exception NonDisjointUnion of atom
......
...@@ -30,6 +30,8 @@ module Set : sig ...@@ -30,6 +30,8 @@ module Set : sig
val disjoint: t -> t -> bool val disjoint: t -> t -> bool
val union_many: ('a -> t) -> 'a list -> t
(* Disjoint union. *) (* Disjoint union. *)
exception NonDisjointUnion of atom exception NonDisjointUnion of atom
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment