LinkedList enumIter

Enumerates all iterators in ascending index order using an input function with the possibility to interrupt. Elements can be read and written using this function, as well as erased and inserted to the list using the iterators given in the body.

The

list
to enumerate.
body
is the callable to be called for each iterator. It has the following stack notation:

( iterator -- condition )

An iterator for each list entry will be provided as an input

iterator
to the callable. When the output
condition
is FALSE, enumeration interrupts.

Return values

None

Complexity

O(size)

Example

"sl/linkedList" useFile a: (1 2 0 5 45 3 54 98) makeList; a [it:; it.get 2 mod 0 = [it a.eraseIter] when TRUE] enumIter a [it:; it.get print "," print TRUE] enumIter
Output:
1,5,45,3,