Previous section: Operations on Lists
Dylan reference manual -- Operations on Ranges
Operations on Ranges
range #key from to above below by size => range [Function]
Creates
a range. from (default 0) is the first value in the range. by
(default 1) is the step between consecutive elements of the range. to,
above and below, constrain the range. to is an inclusive
bound, above is an exclusive lower bound and below is an
exclusive upper bound. above and below constrain the range
independent of the sign of by. See <range>
member? val range #key test => boolean [G.F. Method]
If
range is unbounded, this method is guaranteed to terminate if
test is == (the default).
size range => size [G.F. Method]
For
unbounded ranges, size always terminates and returns #f. For
finite ranges, size returns an integer.
copy-sequence range #key start end => new-range [G.F. Method]
When
applied to a range, copy-sequence returns another range, even though
the class-for-copy of a range is the <list> class.
range1 =range2 => boolean [G.F. Method]
When
called with two ranges, = always terminates, even if one or both
ranges are unbounded in size.
reverse range => new-range [G.F. Method]
Reversing
a range produces another range. An unbounded range cannot be reversed.
reverse! range => range [G.F. Method]
The
result of reverse! on a range is == to the range
argument. An unbounded range cannot be reversed.
intersection range1 range2 #key test => range [G.F. Method]
intersection
applied to two ranges and a test of == (the default) will produce
another range as its result, even though the class-for-copy of a range
is not <range>. If either range1 or range2 is
unbounded, this method is guaranteed to terminate only if the test is
==.
Next section: Operations on Stretchy Vectors