zip-with ( ... seq quot: ( ... key -- ... value ) -- ... alist )
Factor handbook » The language » Collections » Associative mapping operations » Associative mapping conversions

Prev:zip-index-as ( values exemplar -- assoc )
Next:zip-with-as ( ... seq quot: ( ... key -- ... value ) exemplar -- ... assoc )


Vocabulary
assocs

Inputs
seqa sequence
quota quotation with stack effect ( ... key -- ... value )


Outputs
alistan assoc


Examples
USING: assocs math prettyprint ; { 1 2 3 4 } [ sq ] zip-with .
{ { 1 1 } { 2 4 } { 3 9 } { 4 16 } }


Word description
Zip a sequence with values generated by applying quot to each element in the sequence.

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

Definition

: zip-with
( ... seq quot: ( ... key -- ... value ) -- ... alist )
{ } zip-with-as ; inline