module type S = sig
.. end
Module for simple closed intervals over arbitrary types that are ordered correctly
using polymorphic compare.
val create : 'a Interval_intf.T.bound -> 'a Interval_intf.T.bound -> 'a Interval_intf.T.t
val empty : 'a Interval_intf.T.t
val intersect : 'a Interval_intf.T.t -> 'a Interval_intf.T.t -> 'a Interval_intf.T.t
val is_empty : 'a Interval_intf.T.t -> bool
val is_empty_or_singleton : 'a Interval_intf.T.t -> bool
val bounds : 'a Interval_intf.T.t ->
('a Interval_intf.T.bound * 'a Interval_intf.T.bound) option
val lbound : 'a Interval_intf.T.t -> 'a Interval_intf.T.bound option
val ubound : 'a Interval_intf.T.t -> 'a Interval_intf.T.bound option
val bounds_exn : 'a Interval_intf.T.t -> 'a Interval_intf.T.bound * 'a Interval_intf.T.bound
val lbound_exn : 'a Interval_intf.T.t -> 'a Interval_intf.T.bound
val ubound_exn : 'a Interval_intf.T.t -> 'a Interval_intf.T.bound
val contains : 'a Interval_intf.T.t -> 'a Interval_intf.T.bound -> bool
val compare_value : 'a Interval_intf.T.t ->
'a Interval_intf.T.bound ->
[ `Above | `Below | `Interval_is_empty | `Within ]
val bound : 'a Interval_intf.T.t ->
'a Interval_intf.T.bound -> 'a Interval_intf.T.bound option
bound i x
bounds the value x to the interval i. It returns None if the
interval is empty and Some x' otherwise, where x' is the bounded value.
val is_superset : 'a Interval_intf.T.t -> of_:'a Interval_intf.T.t -> bool
is_superset i1 of_:i2
is whether i1 contains i2. The empty interval is
contained in every interval.
val is_subset : 'a Interval_intf.T.t -> of_:'a Interval_intf.T.t -> bool
val map : f:('a Interval_intf.T.bound -> 'b Interval_intf.T.bound) ->
'a Interval_intf.T.t -> 'b Interval_intf.T.t
val are_disjoint : 'a Interval_intf.T.t list -> bool
Returns true iff a given set of intervals are disjoint
val are_disjoint_as_open_intervals : 'a Interval_intf.T.t list -> bool
Returns true iff a given set of intervals would be disjoint if considered as open
intervals. i.e., (3,4) and (4,5) would count as disjoint.
val list_intersect : 'a Interval_intf.T.t list ->
'a Interval_intf.T.t list -> 'a Interval_intf.T.t list
Assuming that ilist1
and ilist2
are lists of (disjoint) intervals,
list_intersect ilist1 ilist2
returns the list of disjoint intervals that correspond
to the intersection of ilist1
with ilist2
.
val half_open_intervals_are_a_partition : 'a Interval_intf.T.t list -> bool