Algorithm.eachIter

Enumerates all entries of an enumerable. While enumerating, you can read and write entries using

get
and
set
methods of the iterator.

Arguments

The

enumerable
, can be a Container, a Range, or a builtin-list.
The
callable
will be called for each iterator. It has the following stack notation:

( iterator -- )

An iterator for each entry will be provided as an input

iterator
to the callable.

Return values

None

Complexity

Depends on the enumerable and the callable.

Example

"sl/algorithm" useFile "sl/linkedList" useFile a: (1 2 3 4 5 6) makeList; a [ it:; it.get dup * it.set ] eachIter a [ print "," print ] each
Output:
1,4,9,16,25,36,