package rangeSet

  1. Overview
  2. Docs

Module Discrete.MakeSource

Functor building an implementation of the RangeSet.Discrete structure given a totally ordered type.

Parameters

module Ord : OrderedType

Signature

Sourcetype t

The type of the sets.

Sourcetype range = {
  1. start : Ord.t;
  2. stop : Ord.t;
}

The type of the range. A range consists of start and end endpoint.

Sourceval range_to_string : range -> string

range_to_string range is the written representation of range.

Sourceval to_string : t -> string

to_string set is the written representation of set.

Sourceval empty : t

The empty set.

Sourceval is_empty : t -> bool

is_empty t tests whether t is empty or not.

Sourceval mem : Ord.t -> t -> bool

mem x s tests whether x belongs to the set s.

Sourceval add : Ord.t -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged.

Sourceval singleton : Ord.t -> t

singleton x returns the one-element set containing only x.

Sourceval of_point : Ord.t -> Ord.t -> t

of_point p1 p2 returns the set containing a range from p1 to p2.

Sourceval of_range : range -> t

of_range r returns the set containing only the range.

Sourceval of_ranges : range list -> t

of_ranges rs returns the set containing all the ranges in rs.

Sourceval remove : Ord.t -> t -> t

remove x s returns a set containing all elements of s, except x.

Sourceval merge : range -> t -> t

merge r s returns a set containing all elements of s , plus range r.

Sourceval unmerge : range -> t -> t

unmerge r s returns a set containing all elements of s, except those in range r.

Sourceval cover : range -> t -> t

cover r s returns a set containing elements both belongs to range r and set s.

Sourceval union : t -> t -> t

Set union.

Sourceval diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

Sourceval inter : t -> t -> t

Set intersection.

Sourceval min_elt : t -> Ord.t

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

Sourceval min_elt_opt : t -> Ord.t option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

Sourceval max_elt : t -> Ord.t

Return the largest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

Sourceval max_elt_opt : t -> Ord.t option

Return the largest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

Sourceval iter_elt : (Ord.t -> unit) -> t -> unit

iter_elt f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

Sourceval map_elt : (Ord.t -> Ord.t) -> t -> t

map_elt f s is the set whose elements are f a0,f a1... f aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

Sourceval elements : t -> Ord.t list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Discrete.Make.