package diet

  1. Overview
  2. Docs

Module type Diet.INTERVAL_SETSource

Sourcetype elt

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

include Sexplib0.Sexpable.S with type t := t
Sourceval t_of_sexp : Sexplib0.Sexp.t -> t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
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

OCaml

Innovation. Community. Security.