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