Pair-wise sequence combinators
Factor handbook > The language > Collections > Sequence operations > Sequence combinators

Prev:all? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
Next:Triple-wise sequence combinators


There is a set of combinators which traverse two sequences pairwise. If one sequence is shorter than the other, then only the prefix having the length of the minimum of the two is examined.
2each ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... ) -- ... )

2reduce ( ... seq1 seq2 identity quot: ( ... prev elt1 elt2 -- ... next ) -- ... result )

2map ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) -- ... newseq )

2map-as ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) exemplar -- ... newseq )

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

2all? ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... ? ) -- ... ? )