package fmlib_std

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A set based on arrays

Parameters

Signature

include Interfaces.SET with type item = Key.t
type item = Key.t

Type of elements of the set.

type t

Type of the set of elements of type item.

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.

val mem : item -> t -> bool

mem element set Is element a member of the set set?

val fold_left : ('accu -> item -> 'accu) -> 'accu -> t -> 'accu

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.

val fold_right : ('accu -> item -> 'accu) -> 'accu -> t -> 'accu

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 elements : t -> item list

The elements of the set in ascending order returned as a list.

val empty : t

The empty set.

val add : item -> t -> t

add element set Add the element element to the set set. If the element is already in the set, then do nothing.

val remove : item -> t -> t

remove element set Remove the element element from the set set. If the element is not in the set, then do nothing.

val element : int -> t -> Key.t

element i set The ith element of the set.

val index_of : Key.t -> t -> int option

index_of e set Compute the index of the element e within the set set, if e is in the set.

val singleton : Key.t -> t

singleton e The singleton set with the only element e.

OCaml

Innovation. Community. Security.