find-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )
Factor handbook » The language » Collections » Sequence operations » Searching sequences

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


Vocabulary
sequences

Inputs
na starting index
seqa sequence
quota quotation with stack effect ( ... elt -- ... ? )


Outputs
ithe index of the first match or f
eltthe first matching element or f


Word description
Applies the quotation to each element of the sequence in turn, until it outputs a true value or the end of the sequence is reached. If the quotation yields a true value for some sequence element, the word outputs the element index and the element itself. Otherwise, the word outputs an index of f and f as the element.

See also
find, find-last, find-last-from, search

Definition