Handbook
Glossary
subseq-index-from ( n seq subseq -- i/f )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Searching sequences
Prev:
subseq-index ( seq subseq -- i/f )
Next:
subseq-starts-at? ( i seq subseq -- ? )
Vocabulary
sequences
Inputs
n
a start index
seq
a
sequence
subseq
a
sequence
Outputs
i/f
a start index or
f
Word description
Outputs the start index of the first contiguous subsequence equal to
subseq
, starting the search from the
n
th element. If no matching subsequence is found, outputs
f
.
Definition
USING:
kernel
math
;
IN:
sequences
:
subseq-index-from
( n seq subseq -- i/f )
[
2length
-
1
+
]
2keep
[
subseq-starts-at?
]
2curry
find-integer-from
;
inline