2map-as ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) exemplar -- ... newseq )
Factor handbook > The language > Collections > Sequence operations > Sequence combinators > Pair-wise sequence combinators

Prev:2map ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) -- ... newseq )
Next:2map-reduce ( ..a seq1 seq2 map-quot: ( ..a elt1 elt2 -- ..b intermediate ) reduce-quot: ( ..b prev intermediate -- ..a next ) -- ..a result )


Vocabulary
sequences

Inputs and outputs
seq1a sequence
seq2a sequence
quota quotation with stack effect ( ... elt1 elt2 -- ... newelt )
exemplara sequence
newseqa new sequence


Word description
Applies the quotation to each pair of elements in turn, yielding new elements which are collected into a new sequence having the same class as exemplar.

Definition


: 2map-as
( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) exemplar -- ... newseq )
[ (2each) ] dip map-integers ; inline