E : ELEMENT
type t
type elt
= E.t
val create : int ‑> t
create n makes a new set with the given capacity n.
create n
n
val singleton : elt ‑> t
singleton x is the singleton {x}.
singleton x
{x}
val clear : t ‑> unit
clear s removes all elements from s.
clear s
s
val copy : t ‑> t
Fresh copy.
val copy_into : into:t ‑> t ‑> unit
copy_into ~into s copies all elements of s into into.
copy_into ~into s
into
val insert : t ‑> elt ‑> unit
insert s x adds x into s.
insert s x
x
val remove : t ‑> elt ‑> unit
Remove the element, if it were in there.
val cardinal : t ‑> int
cardinal s returns the number of elements in s.
cardinal s
val mem : t ‑> elt ‑> bool
mem s x returns true iff x is in s.
mem s x
true
val find_exn : t ‑> elt ‑> elt
find_exn s x returns y if x and y are equal, and mem s y.
find_exn s x
y
mem s y
val find : t ‑> elt ‑> elt option
Safe version of find_exn.
val inter : t ‑> t ‑> t
inter a b returns a ∩ b.
inter a b
a ∩ b
val inter_mut : into:t ‑> t ‑> unit
inter_mut ~into a changes into into a ∩ into.
inter_mut ~into a
a ∩ into
val union : t ‑> t ‑> t
union a b returns a ∪ b.
union a b
a ∪ b
val union_mut : into:t ‑> t ‑> unit
union_mut ~into a changes into into a ∪ into.
union_mut ~into a
a ∪ into
val diff : t ‑> t ‑> t
diff a b returns a - b.
diff a b
a - b
val subset : t ‑> t ‑> bool
subset a b returns true if all elements of a are in b.
subset a b
a
b
val equal : t ‑> t ‑> bool
equal a b is extensional equality (a and b have the same elements).
equal a b
val for_all : (elt ‑> bool) ‑> t ‑> bool
val exists : (elt ‑> bool) ‑> t ‑> bool
val iter : (elt ‑> unit) ‑> t ‑> unit
Iterate on values.
val fold : ('a ‑> elt ‑> 'a) ‑> 'a ‑> t ‑> 'a
Fold on values.
val elements : t ‑> elt list
List of elements.
val of_list : elt list ‑> t
val to_seq : t ‑> elt sequence
val of_seq : elt sequence ‑> t
val add_seq : t ‑> elt sequence ‑> unit
val pp : ?sep:string ‑> elt printer ‑> t printer
pp pp_elt returns a set printer, given a printer for individual elements.
pp pp_elt