Module for simple closed intervals over arbitrary types that are ordered correctly using polymorphic compare.
Module for simple closed intervals over arbitrary types that are ordered correctly using polymorphic compare.
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
.
If one thinks of an interval as a set of points, rather than a pair of its bounds,
then map
is not the same as the usual mathematical notion of mapping f
over that
set. For example, ~f:(fun x -> x * x)
maps the interval
[-1,1]
to
[1,1]
, not to
[0,1]
.
are_disjoint ts
returns true
iff the intervals in ts
are pairwise 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.