2reduce ( ... seq1 seq2 identity quot: ( ... prev elt1 elt2 -- ... next ) -- ... result )
Factor handbook » The language » Collections » Sequence operations » Sequence combinators » Pair-wise sequence combinators

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


Vocabulary
sequences

Inputs
seq1a sequence
seq2a sequence
identityan object
quota quotation with stack effect ( ... prev elt1 elt2 -- ... next )


Outputs
resultthe final result


Word description
Combines successive pairs of elements from the two sequences using a ternary operation. The first input value at each iteration except the first one is the result of the previous iteration. The first input value at the first iteration is identity.

See also
vdot

Definition


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