Searching sequences
Factor handbook > The language > Collections > Sequence operations

Prev:Testing sequences
Next:Comparing sequences


Finding the index of an element:
index ( obj seq -- n )

index-from ( obj i seq -- n )

last-index ( obj seq -- n )

last-index-from ( obj i seq -- n )


Finding the start of a subsequence:
subseq-start ( subseq seq -- i )

subseq-start-from ( subseq seq n -- i )


Finding the index of an element satisfying a predicate:
find ( ... seq quot: ( ... elt -- ... ? ) -- ... i elt )

find-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )

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

find-last-from ( ... n seq quot: ( ... elt -- ... ? ) -- ... i elt )

map-find ( ... seq quot: ( ... elt -- ... result/f ) -- ... result elt )