Handbook
Glossary
last-index ( obj seq -- n )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Searching sequences
Prev:
index-from ( obj i seq -- n )
Next:
last-index-from ( obj i seq -- n )
Vocabulary
sequences
Inputs
obj
an
object
seq
a
sequence
Outputs
n
an index
Word description
Outputs the index of the last element in the sequence equal to
obj
; the sequence is traversed back to front. If no element is found, outputs
f
.
See also
index
,
index-from
,
last-index-from
,
sorted-index
Definition
USING:
kernel
;
IN:
sequences
:
last-index
( obj seq -- n )
[
=
]
with
find-last
drop
;