|
|
@ -44,6 +44,8 @@
|
|
|
|
of sets of [int * int].
|
|
|
|
of sets of [int * int].
|
|
|
|
*)
|
|
|
|
*)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
open! NS0
|
|
|
|
|
|
|
|
|
|
|
|
module type OrderedType =
|
|
|
|
module type OrderedType =
|
|
|
|
sig
|
|
|
|
sig
|
|
|
|
type t
|
|
|
|
type t
|
|
|
@ -191,6 +193,11 @@ module type S =
|
|
|
|
to the ordering [Ord.compare], where [Ord] is the argument
|
|
|
|
to the ordering [Ord.compare], where [Ord] is the argument
|
|
|
|
given to {!Set.Make}. *)
|
|
|
|
given to {!Set.Make}. *)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val only_elt: t -> elt option
|
|
|
|
|
|
|
|
(** Return the element of a singleton set, or None otherwise. *)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val classify : t -> elt zero_one_many
|
|
|
|
|
|
|
|
|
|
|
|
val min_elt: t -> elt
|
|
|
|
val min_elt: t -> elt
|
|
|
|
(** Return the smallest element of the given set
|
|
|
|
(** Return the smallest element of the given set
|
|
|
|
(with respect to the [Ord.compare] ordering), or raise
|
|
|
|
(with respect to the [Ord.compare] ordering), or raise
|
|
|
@ -215,16 +222,24 @@ module type S =
|
|
|
|
|
|
|
|
|
|
|
|
val choose: t -> elt
|
|
|
|
val choose: t -> elt
|
|
|
|
(** Return one element of the given set, or raise [Not_found] if
|
|
|
|
(** Return one element of the given set, or raise [Not_found] if
|
|
|
|
the set is empty. Which element is chosen is unspecified,
|
|
|
|
the set is empty. Which element is chosen is unspecified, and
|
|
|
|
but equal elements will be chosen for equal sets. *)
|
|
|
|
different elements may be chosen for equal sets. *)
|
|
|
|
|
|
|
|
|
|
|
|
val choose_opt: t -> elt option
|
|
|
|
val choose_opt: t -> elt option
|
|
|
|
(** Return one element of the given set, or [None] if
|
|
|
|
(** Return one element of the given set, or [None] if
|
|
|
|
the set is empty. Which element is chosen is unspecified,
|
|
|
|
the set is empty. Which element is chosen is unspecified, and
|
|
|
|
but equal elements will be chosen for equal sets.
|
|
|
|
different elements may be chosen for equal sets.
|
|
|
|
@since 4.05
|
|
|
|
@since 4.05
|
|
|
|
*)
|
|
|
|
*)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val pop : t -> elt * t
|
|
|
|
|
|
|
|
(** Find and remove an unspecified element, or raise [Not_found] if the
|
|
|
|
|
|
|
|
set is empty. [O(1)]. *)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val pop_opt : t -> (elt * t) option
|
|
|
|
|
|
|
|
(** Find and remove an unspecified element, or [None] if the set is
|
|
|
|
|
|
|
|
empty. [O(1)]. *)
|
|
|
|
|
|
|
|
|
|
|
|
val split: elt -> t -> t * bool * t
|
|
|
|
val split: elt -> t -> t * bool * t
|
|
|
|
(** [split x s] returns a triple [(l, present, r)], where
|
|
|
|
(** [split x s] returns a triple [(l, present, r)], where
|
|
|
|
[l] is the set of elements of [s] that are
|
|
|
|
[l] is the set of elements of [s] that are
|
|
|
|