module Interval_intf:sig
..end
module type Gen =sig
..end
module type Gen_set =sig
..end
module type S =sig
..end
module type S1 =sig
..end
create l u
returns the interval with lower bound l
and upper bound u
, unless
l > u
, in which case create
returns the empty interval.bound t x
returns None
iff is_empty t
. If bounds t = Some (a, b)
, then
bound
returns Some y
where y
is the element of t
closest to x
. I.e.:
| y = a if x < a
| y = x if a <= x <= b
| y = b if x > b
is_superset i1 of_:i2
is whether i1 contains i2. The empty interval is
contained in every interval.
map t ~f
returns create (f l) (f u)
if bounds t = Some (l, u)
, and empty
if
t
is empty. Note that if f l > f u
, the result of map
is empty
, by the
definition of create
.
Returns true iff a given set of intervals are disjoint
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.
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
.