Range enum

Enumerates all entries in a range.

Arguments

The

range
to enumerate.
body
is the callable to be called for each entry of the range. It has the following stack notation for ArrayRange and LinkedListRange:

( value -- condition )

and the following for HashTableRange and RedBlackTreeRange:

( { key: Key; value: Value; } -- condition )

Each entry will be provided as an input to the callable. When the output

condition
is FALSE, enumeration interrupts.

Return values

None

Complexity

O(rangeSize), for RedBlackTree can be max(O(rangeSize), O(log(treeSize))).

Example

"sl/linkedList" useFile l: (1 2 10 50) makeList; r: l.makeRange; r [print "," print TRUE] enum
Output:
1,2,10,50,