- (Array)

( iterator0 shift -- iterator1 )

Returns an iterator shifted backward by a given number of entries.

( iterator0 iterator1 -- shift )

Calculates a shift from one iterator to another.

Arguments

( iterator0 shift -- iterator1 )

iterator0
is the initial ArrayIterator.
shift
is an integer number to shift the iterator by.

( iterator0 iterator1 -- shift )

iterator0
is the ArrayIterator to calculate shift from.
iterator1
is the ArrayIterator to calculate shift to.

Return values

( iterator0 shift -- iterator1 )

iterator1
is the iterator shifted backward by the given number of positions. If
shift
is zero, returns the same iterator, if it is negative, shifts forward.

( iterator0 iterator1 -- shift )

shift
as an integer number. If
iterator0
index is less than
iterator1
index, the result will be negative; if the indexes are equal, the result will be 0; otherwise, the result will be positive.

Complexity

Constant

Example

"sl/array" useFile a: (-1 2 3 5 6 "7") makeArray; "THREE" a.lastIter 3 - .set a [ print "," print TRUE ] enum LF print a.lastIter a.firstIter - print
Output:
-1,2,THREE,5,6,7, 5