Array.Set
A set based on arrays
module Key : Interfaces.SORTABLE
include Interfaces.SET with type item = Key.t
type item = Key.t
Type of elements of the set.
val is_empty : t -> bool
Is the set empty?
val cardinal : t -> int
The cardinality of the set i.e. the number of its elements.
fold_left f start set
Fold the elements of the set set
from left to right i.e. lexically ascending using the start value start
for the accumulator and the folding function f
where f
is applied f accu element
yielding a new accumulator value by consuming one element.
fold_left f start set
Fold the elements of the set set
from right to left i.e. lexically descending using the start value start
for the accumulator and the folding function f
where f
is applied f accu element
yielding a new accumulator value by consuming one element.
val empty : t
The empty set.
add element set
Add the element element
to the set set
. If the element is already in the set, then do nothing.
index_of e set
Compute the index of the element e
within the set set
, if e
is in the set.