Handbook
Glossary
take-until-sequence ( sequence-parser sequence -- sequence'/f )
Vocabulary
sequences
.
parser
Inputs
sequence-parser
a
sequence-parser
sequence
a
sequence
Outputs
sequence'/f
a
sequence
or
f
Definition
USING:
accessors
circular
kernel
math
sequences
;
IN:
sequences.parser
::
take-until-sequence
( sequence-parser sequence -- sequence'/f )
sequence-parser
n>>
:>
saved sequence
length
<growing-circular>
:>
growing sequence-parser
[
current
growing
growing-circular-push
sequence growing
sequence=
]
take-until
:>
found growing sequence
sequence=
[
found
dup
length
growing
length
1
-
-
head
sequence-parser
[
growing
length
-
1
+
]
change-n
drop
]
[
saved sequence-parser
n<<
f
]
if
;