Module Qcow_int.IntervalSet

type elt = t

The type of the set elements

type interval

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

module Interval : sig ... end
type t

The type of sets

include Ppx_sexp_conv_lib.Sexpable.S with type IntervalSet.t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
val sexp_of_t : t -> Sexplib0.Sexp.t
val empty : t

The empty set

val is_empty : t -> bool

Test whether a set is empty or not

val cardinal : t -> elt

cardinal t is the number of elements in the set t

val mem : elt -> t -> bool

mem elt t tests whether elt is in set t

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

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

val fold_s : (interval -> 'a -> 'a Lwt.t) -> t -> 'a -> 'a Lwt.t

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

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

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

val add : interval -> t -> t

add interval t returns the set consisting of t plus interval

val remove : interval -> t -> t

remove interval t returns the set consisting of t minus interval

val 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.

val 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.

val choose : t -> interval

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

val 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

val union : t -> t -> t

set union

val diff : t -> t -> t

set difference

val inter : t -> t -> t

set intersection