Handbook
Glossary
split-find ( seq quot: ( seq -- i ) -- pieces )
Vocabulary
splitting
.
extras
Inputs
seq
a
sequence
quot
a
quotation
with stack effect
( seq -- i )
Outputs
pieces
a new array
Word description
Splits a sequence into slices using the provided quotation to find split points.
Definition
USING:
kernel
math
sequences
;
IN:
splitting.extras
:
split-find
( seq quot: ( seq -- i ) -- pieces )
[
dup
empty?
not
]
swap
[
[
dup
]
]
dip
[
[
[
1
]
when-zero
cut-slice
swap
]
[
f
swap
]
if*
]
compose
compose
produce
nip
;
inline