added split in the result of Set.Make

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6202 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Basile Starynkevitch 2004-04-14 11:10:22 +00:00
parent bde72ee4d5
commit 4041c97364
3 changed files with 10 additions and 0 deletions

View File

@ -115,6 +115,7 @@ module Set : sig
val min_elt : t -> elt val min_elt : t -> elt
val max_elt : t -> elt val max_elt : t -> elt
val choose : t -> elt val choose : t -> elt
val split: elt -> t -> t * bool * t
end end
module Make : functor (Ord : OrderedType) -> S with type elt = Ord.t module Make : functor (Ord : OrderedType) -> S with type elt = Ord.t
end end

View File

@ -48,6 +48,7 @@ module type S =
val min_elt: t -> elt val min_elt: t -> elt
val max_elt: t -> elt val max_elt: t -> elt
val choose: t -> elt val choose: t -> elt
val split: elt -> t -> t * bool * t
end end
module Make(Ord: OrderedType) = module Make(Ord: OrderedType) =

View File

@ -136,6 +136,14 @@ module type S =
(** 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,
but equal elements will be chosen for equal sets. *) but equal elements will be chosen for equal sets. *)
val split: elt -> t -> t * bool * t
(** Splitting. [split x s] returns a triple [(l, present, r)] where
- [l] is the set of elements of s that are < x
- [r] is the set of elements of s that are > x
- [present] is false if [s] contains no element equal to [x],
or true if [s] contains an element equal to [x]. *)
end end
(** Output signature of the functor {!Set.Make}. *) (** Output signature of the functor {!Set.Make}. *)