set
Totally ordered sets
type t<elt> = set<elt>
The type Set.t<elt> is an alias for set<elt>.
empty: <elt>t<elt>
The value Set.empty denotes the empty set. In some contexts, it is
useful to annotate it with its type, for example:
(Set.empty as set<int>).
update: <elt>(elt: elt, add: bool, set: t<elt>) => t<elt>
The call Set.update(elt, true, set) is a copy of the set set
containing the element elt. The call Set.update(elt, false, set) is a
copy of the set set where the element elt is absent.
add: <elt>(elt: elt, set: t<elt>) => t<elt>
The call Set.add(elt, set) is a set containing all the elements of
the set set, plus the element elt.
remove: <elt>(elt: elt, set: t<elt>) => t<elt>
The call Set.remove(elt, set) is a copy of the set set without the
element elt.
literal: <elt>(_: list<elt>) => t<elt>
The call Set.literal(list([e1, ..., en])) is a set containing
exactly the elements in the list. Note: The list must be literal, not
an expression (compile-time list of values).
of_list: <elt>(_: list<elt>) => t<elt>
The call Set.of_list(elements) is a set containing exactly the
elements in the list elements. Note: Use Set.literal instead if
using a literal list. Note: Use literal instead if using a literal
list.
size: <elt>(_: t<elt>) => nat
The call Set.size(set) is the number of elements of the set set.
cardinal: <elt>(_: t<elt>) => nat
The call Set.cardinal(set) is the number of elements of the set set.
mem: <elt>(elt: elt, set: t<elt>) => bool
The call Set.mem(elt, set) is true if, and only if, the element
elt belongs to the set set.
fold: <elt, acc>(f: (_: [acc, elt]) => acc, set: t<elt>, init: acc) => acc
The call Set.fold(f, set, init) is f(... (f (f (init, e1), e2), ...), en), where e1, e2, ..., en are the elements of the
set set in increasing order.
fold_desc: <elt, acc>(f: (_: [elt, acc]) => acc, set: t<elt>, init: acc) => acc
The call Set.fold(f, set, init) is f(... (f (init, en), ...), e1),
where e1, e2, ..., en are the elements of the set set in
increasing order.
filter_map: <old, new>(filter: (elt: old) => option<new>, set: t<old>) => t<new>
The call Set.filter_map(f, set) is a set made by calling f (the
filter) on each element of the set set: if f returns
["None" as "None"], the element is skipped in the result, otherwise,
if it is ["Some" as "Some", e], then e is kept.
iter: <elt>(f: (_: elt) => unit, set: t<elt>) => unit
The call Set.iter(f, set) applies f to all the elements of the set
set in increasing order.
map: <old, new>(f: (elt: old) => new, set: t<old>) => t<new>
The call Set.map(f, set) evaluates in a set whose elements have been
obtained by applying f to the elements of the set set.