package diet

  1. Overview
  2. Docs

Module Diet.IntSource

Sourcetype elt = int

The type of the set elements

Sourcetype interval

An interval: a range (x, y) of set values where all the elements from x to y inclusive are in the set

Sourcemodule Interval : sig ... end
Sourcetype t

The type of sets

Sourceval equal : t -> t -> bool

Equality over sets

Sourceval compare : t -> t -> int

Comparison over sets

Sourceval pp : Format.formatter -> t -> unit

Pretty-print a set

Sourceval empty : t

The empty set

Sourceval is_empty : t -> bool

Test whether a set is empty or not

Sourceval cardinal : t -> elt

cardinal t is the number of elements in the set t

Sourceval mem : elt -> t -> bool

mem elt t tests whether elt is in set t

Sourceval fold : (interval -> 'a -> 'a) -> t -> 'a -> 'a

fold f t acc folds f across all the intervals in t

Sourceval fold_individual : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold_individual f t acc folds f across all the individual elements of t

Sourceval iter : (interval -> unit) -> t -> unit

iter f t iterates f across all the intervals in t

Sourceval add : interval -> t -> t

add interval t returns the set consisting of t plus interval

Sourceval remove : interval -> t -> t

remove interval t returns the set consisting of t minus interval

Sourceval min_elt : t -> interval

min_elt t returns the smallest (in terms of the ordering) interval in t, or raises Not_found if the set is empty.

Sourceval max_elt : t -> interval

max_elt t returns the largest (in terms of the ordering) interval in t, or raises Not_found if the set is empty.

Sourceval choose : t -> interval

choose t returns one interval, or raises Not_found if the set is empty

Sourceval take : t -> elt -> (t * t) option

take n returns Some a, b where cardinal a = n and diff t a = b or None if cardinal t < n

Sourceval union : t -> t -> t

set union

Sourceval diff : t -> t -> t

set difference

Sourceval inter : t -> t -> t

set intersection

Sourceval find_next_gap : elt -> t -> elt

find_next_gap from t returns the next element that's absent in set t and greater than or equal to from *

OCaml

Innovation. Community. Security.