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 )
Next:map-find-last ( ... seq quot: ( ... elt -- ... result/f ) -- ... result elt )


Vocabulary
sequences

Inputs
seqa sequence
quota quotation with stack effect ( ... elt -- ... result/f )


Outputs
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.

See also
map-find-last

Definition


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