find-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )
Factor documentation > 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 and outputs
na starting index
seqa sequence
quota quotation with stack effect ( ... elt -- ... ? )
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, find-last-from, search

Definition
USING: math sequences.private ;

IN: sequences

: find-from
( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )
[ (find-integer) ] (find-from) ; inline