zip-index ( values -- alist )
Factor handbook » The language » Collections » Associative mapping operations » Associative mapping conversions

Prev:zip-as ( keys values exemplar -- assoc )
Next:zip-index-as ( values exemplar -- assoc )


Vocabulary
assocs

Inputs
valuesa sequence


Outputs
alistan array of key/value pairs


Examples
Zip a sequnce with its indices:
USING: assocs prettyprint ; { 100 200 300 } zip-index .
{ { 100 0 } { 200 1 } { 300 2 } }


Word description
Zip a sequence with its index and return an associative list where the input sequence is the keys and the indices are the values.

See also
unzip, zip, zip-as, zip-index-as, zip-with, zip-with-as

Definition

: zip-index ( values -- alist ) { } zip-index-as ; inline