each-index ( ... seq quot: ( ... elt index -- ... ) -- ... )
Factor handbook » The language » Collections » Sequence operations » Sequence combinators

Prev:each ( ... seq quot: ( ... x -- ... ) -- ... )
Next:reduce ( ... seq identity quot: ( ... prev elt -- ... next ) -- ... result )


Vocabulary
sequences

Inputs
seqa sequence
quota quotation with stack effect ( ... elt index -- ... )


Outputs
None

Word description
Calls the quotation with the element of the sequence and its index on the stack, with the index on the top of the stack.

Examples
USING: arrays sequences prettyprint ; { 10 20 30 } [ 2array . ] each-index
{ 10 0 } { 20 1 } { 30 2 }


Definition