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

Prev:subseq-starts-at? ( i seq subseq -- ? )
Next:find-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )


Vocabulary
sequences

Inputs
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
A simpler variant of find-from where the starting index is 0.

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

Definition


: find ( ... seq quot: ( ... elt -- ... ? ) -- ... i elt )
[ 0 ] 2dip do-find-from index/element ; inline