package fmlib_std

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

Interface for a finite set.

type item

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.