Handbook
Glossary
?head ( seq begin -- newseq ? )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Splitting sequences
Next:
?head-slice ( seq begin -- newseq ? )
Vocabulary
splitting
Inputs
seq
a
sequence
begin
a
sequence
Outputs
newseq
a new sequence
?
a
boolean
Word description
Tests if
seq
starts with
begin
. If there is a match, outputs the subrange of
seq
excluding
begin
, and
t
. If there is no match, outputs
seq
and
f
.
Definition
USING:
sequences
splitting.private
;
IN:
splitting
:
?head
( seq begin -- newseq ? )
[
head?
]
[
tail
]
?chomp
;