Darren Duncan wrote:
> In reply to Jon Lang,
>
> What I'm proposing here in the general case, is a generic collection type,
> "Interval" say, that can represent a discontinuous interval of an ordered
> type.  A simple way of defining such a type is that it is a "Set of Pair of
> Ordered", where each Pair defines a continuous interval in terms of 2
> ordered end-points, and the whole set is discontinuous (or replace Pair with
> 2-element Seq).

Note that you lose the distinction between inclusive and exclusive
endpoints if you do this.  That is one benefit that Range has over
Pair: Range _does_ keep track of whether its endpoints are inclusive
or exclusive.  The main problem with Range is that it is (usually?)
enumerable - which is generally considered to be a feature, but which
gets in the way in the case of using it to represent a continuous
interval.  Thus my suggestion of somehow doing away with the
enumerability if the step size is zero.  As such, I'd be inclined to
define Interval as a Range-like role that isn't enumerable,
representing a continuous span between its lower and upper boundaries.
 A "disjoint interval" would be a role that usually delegates to an
internal Set of Interval of Type, except when it needs to do otherwise
in order to resemble a Set of Type.

-- 
Jonathan "Dataweaver" Lang

Reply via email to