Handbook
Glossary
subseq-starts-at? ( i seq subseq -- ? )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Searching sequences
Prev:
subseq-index-from ( n seq subseq -- i/f )
Next:
find ( ... seq quot: ( ... elt -- ... ? ) -- ... i elt )
Vocabulary
sequences
Inputs
i
a start index
seq
a
sequence
subseq
a
sequence
Outputs
?
a
boolean
Word description
Outputs
t
if the subseq starts at the
i
th element or outputs
f
if the sequence is not at that position.
Definition
USING:
kernel
math
sequences.private
;
IN:
sequences
:
subseq-starts-at?
( i seq subseq -- ? )
[
length
swap
]
keep
[
[
[
+
]
]
dip
[
nth-unsafe
]
curry
compose
]
dip
[
[
keep
]
curry
]
dip
[
nth-unsafe
=
]
curry
compose
with
all-integers?
;
inline