package asetmap

  1. Overview
  2. Docs

Set

include Stdlib.Set.S with type elt = Ord.t
type elt = Ord.t
type t
val empty : t
val is_empty : t -> bool
val mem : elt -> t -> bool
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val compare : t -> t -> int
val equal : t -> t -> bool
val subset : t -> t -> bool
val iter : (elt -> unit) -> t -> unit
val map : (elt -> elt) -> t -> t
val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val cardinal : t -> int
val elements : t -> elt list
val min_elt_opt : t -> elt option
val max_elt_opt : t -> elt option
val choose_opt : t -> elt option
val split : elt -> t -> t * bool * t
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_seq : elt Stdlib.Seq.t -> t
val find : elt -> t -> elt option

find e s is the element of s equal to e (if any).

val get : elt -> t -> elt

get is like find but

  • raises Invalid_argument

    if elt is not in s.

val min_elt : t -> elt option

min_elt s is the smallest element of s (if any).

val get_min_elt : t -> elt

get_min_elt is like min_elt but

  • raises Invalid_argument

    on the empty set.

val max_elt : t -> elt option

max_elt s is the greatest element of s (if any).

val get_max_elt : t -> elt

get_max_elt is like max_elt but

  • raises Invalid_argument

    on the empty set.

val choose : t -> elt option

choose s is an element of s or None is s empty. The chosen element is equal for equal sets.

val get_any_elt : t -> elt

get_any_elt is like choose but

  • raises Invalid_argument

    on the empty set.

Conversions

val to_list : t -> elt list

to_list s is the elements of s in increasing order.

val of_list : elt list -> t

of_list l is a set from the elements of l

Pretty-printers

val pp : ?sep:(Stdlib.Format.formatter -> unit -> unit) -> (Stdlib.Format.formatter -> elt -> unit) -> Stdlib.Format.formatter -> t -> unit

pp ~sep pp_elt ppf s formats the elements of s on ppf. Each element is formatted with pp_elt and elements are separated by ~sep (defaults to Format.pp_print_cut). If the set is empty leaves ppf untouched.

val dump : (Stdlib.Format.formatter -> elt -> unit) -> Stdlib.Format.formatter -> t -> unit

dump pp_elt ppf s prints an unspecified representation of s on ppf using pp_elt to print elements.

OCaml

Innovation. Community. Security.