find-last-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )
Factor documentation > Factor handbook > The language > Collections > Sequence operations > Searching sequences
Prev:find-last ( ... seq quot: ( ... elt -- ... ? ) -- ... i elt )
Next:map-find ( ... seq quot: ( ... elt -- ... result/f ) -- ... result 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 reverse order, until it outputs a true value or the start 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-from, find-last, find-last, search

Definition
USING: kernel math sequences.private ;

IN: sequences

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