map-find ( ... seq quot: ( ... elt -- ... result/f ) -- ... result elt )
Factor handbook > The language > Collections > Sequence operations > Searching sequences

Prev:find-last-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )


Vocabulary
sequences

Inputs and outputs
seqa sequence
quota quotation with stack effect ( ... elt -- ... result/f )
resultthe first non-false result of the quotation
eltthe first matching element or f


Word description
Applies the quotation to each element of the sequence, until the quotation outputs a true value. If the quotation ever yields a result which is not f, then the value is output, along with the element of the sequence which yielded this.

Definition


: map-find
( ... seq quot: ( ... elt -- ... result/f ) -- ... result elt )
[ find ] (map-find) ; inline