Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

infix ..

🌌hasInterval.infix ..

defining an integer interval from this to other, both inclusive

special cases of interval a..b:

a < b: the interval from a to b, both inclusive
a == b: the interval containing only one element, a
a > b: an empty interval

create a list from this interval

redefines Set.asList:
list representation of values in this set

redefines Sequence.asList:
create a list from this Sequence.

A list is immutable, so it can be reused and shared between threads.
Compared to a stream, a list may require more (heap) allocation.

Default implementation uses asStream. Heirs must redefine at least
one of asList or asStream.

create a stream of all the elements of this interval, in order.
redefines Sequence.asStream:
create a stream of T.

A stream contains mutable state, so it cannot be reused or shared
between threads.

Default implementation uses asList. Heirs must redefine at least
one of asList or asStream.

string representation of this interval, e.g., "1..10"

redefines Sequence.asString:
create a string representation of this list including all the string
representations of its contents, separated by ',' and enclosed in '['
and ']'.

redefines Object.asString:

does this range contain the given value?

redefines Set.contains:
does this set contain the given value?

apply function f to all elements in this interval
redefines Sequence.forAll:
create a stream and call 'forAll f' on it

Create a Sequence that is stepping through this interval skipping values. For a
non-negative step parameter, the stream will return lower, lower+step,
lower+2*step, etc. as long as these values are <= upper.

For a negative step parameter, the stream will return upper, upper+step,
upper+2*step, etc. as long as these values are >= lower. Note that this means
that a negative step will produce a non-empty stream for an empty interval with
lower > upper!

use map implementation from Sequence: