package menhirGLR

  1. Overview
  2. Docs

Module MenhirGLR.MiniBabySetSource

This module offers a stripped-down weight-balanced binary tree library.

Sourcetype 'a tree

A set.

Sourceval empty : 'a tree

The empty set.

Sourceval add : ('a -> 'a -> int) -> 'a -> 'a tree -> 'a tree

Insertion of an element into a set.

Sourceval add_absent : ('a -> 'a -> int) -> 'a -> 'a tree -> 'a tree

Insertion of an element that is known to be absent.

Sourceval singleton : 'a -> 'a tree

A singleton set.

Sourceval mem : ('a -> 'a -> int) -> 'a -> 'a tree -> bool

A membership test.

Sourceval find : ('a -> 'b -> int) -> 'a -> 'b tree -> 'b option

A heterogeneous membership test.

Sourceval iter : ('a -> unit) -> 'a tree -> unit

Iteration.

Sourceval for_all : ('a -> bool) -> 'a tree -> bool

for_all p s determines whether all elements of the set s satisfy the property p.

Sourceval is_singleton : 'a tree -> bool

is_singleton s tests whether the set s is a singleton set.

Sourceval extract_singleton : 'a tree -> 'a

extract_singleton s extracts the unique element of the set s. The set s must be a singleton.

Sourceval cardinal : 'a tree -> int

cardinal s returns the cardinal of the set s.

Sourceval check : 'a tree -> unit

A well-formedness check. (Checks balance, not BST ordering.)