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

Prev:cartesian-map ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) -- ... newseq )
Next:cartesian-product ( seq1 seq2 -- newseq )


Vocabulary
sequences

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


Outputs
elt1an object
elt2an object


Word description
Applies the quotation to every possible pairing of elements from the two sequences, returning the first two elements where the quotation returns a true value.

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

Definition


: cartesian-find
( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... ? ) -- ... elt1 elt2 )
[ f ] 3dip [ with find swap ] 2curry [ nip ] prepose
find nip swap ; inline