Handbook
Glossary
take-n ( sequence-parser n -- seq/f )
Vocabulary
sequences
.
parser
Inputs
sequence-parser
a
sequence-parser
n
an
integer
Outputs
seq/f
a
sequence
or
f
Definition
USING:
accessors
kernel
math
sequences
;
IN:
sequences.parser
::
take-n
( sequence-parser n -- seq/f )
n sequence-parser
[
n>>
+
]
[
sequence>>
length
]
bi
>
[
sequence-parser
take-rest
]
[
sequence-parser
n>>
dup
n
+
sequence-parser
sequence>>
subseq
sequence-parser
[
n
+
]
change-n
drop
]
if
;