package rangeSet

  1. Overview
  2. Docs

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

Parameters

module Ord : OrderedType

Signature

type t

The type of the sets.

type point =
  1. | Inc of Ord.t
    (*

    including endpoint

    *)
  2. | Exc of Ord.t
    (*

    excluding endpoint

    *)

The type of the point of a range. A point can be either closed or open, respectively Inc elt or Exc elt where elt is of type elt

type range = {
  1. start : point;
  2. stop : point;
}

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

val point_to_string : point -> string

point_to_string point is the written representation of point.

val range_to_string : range -> string

range_to_string range is the written representation of range.

val to_string : t -> string

to_string set is the written representation of set.

val empty : t

The empty set.

val is_empty : t -> bool

is_empty t tests whether t is empty or not.

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

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

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

val singleton : Ord.t -> t

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

val of_point : point -> point -> t

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

val of_range : range -> t

of_range r returns the set containing only the range.

val of_ranges : range list -> t

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

val remove : Ord.t -> t -> t

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

val merge : range -> t -> t

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

val unmerge : range -> t -> t

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

val cover : range -> t -> t

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

val union : t -> t -> t

Set union.

val diff : t -> t -> t

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

val inter : t -> t -> t

Set intersection.

OCaml

Innovation. Community. Security.