cartesian-map ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) -- ... newseq )
Factor handbook » The language » Collections » Sequence operations » Cartesian product operations

Prev:cartesian-each ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... ) -- ... )
Next:cartesian-find ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... ? ) -- ... elt1 elt2 )


Vocabulary
sequences

Inputs
seq1a sequence
seq2a sequence
quota quotation with stack effect ( ... elt1 elt2 -- ... newelt )


Outputs
newseqa new sequence of sequences


Word description
Applies the quotation to every possible pairing of elements from the two sequences, collecting results into a new sequence of sequences.

See also
cartesian-find, cartesian-each, cartesian-product, cartesian-product-as

Definition


: cartesian-map
( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) -- ... newseq )
[ with { } map-as ] 2curry { } map-as ; inline