interval
Factor documentation > Factor handbook > The language > Numbers > Intervals
Prev:Properties of interval arithmetic
Next:interval? ( object -- ? )


Vocabulary
math.intervals

Class description
An interval represents a set of real numbers between two endpoints; the endpoints can either be included or excluded from the interval.

The from and to slots store endpoints, represented as arrays of the shape { number included? }.

Intervals are created by calling [a,b], (a,b), [a,b), (a,b] or [a,a].

Definition
IN: math.intervals

TUPLE: interval { from read-only } { to read-only } ;


Methods
USING: accessors db.queries kernel math.intervals nmake ;

M: interval where
[
[ from>> "from" where-interval ]
[ nip infinite-interval? [ " and " 0% ] unless ]
[ to>> "to" where-interval ] 2tri
] in-parens ;