Handbook
Glossary
(split*) ( ... seq quot: ( ... elt -- ... ? ) slice-quot -- ... pieces )
Vocabulary
splitting
.
extras
.
private
Inputs
seq
an
object
quot
a
quotation
with stack effect
( ... elt -- ... ? )
slice-quot
an
object
Outputs
pieces
an
object
Definition
USING:
kernel
math
sequences
;
IN:
splitting.extras.private
::
(split*)
( ... seq quot: ( ... elt -- ... ? ) slice-quot -- ... pieces )
0
[
[
seq quot
find-from
drop
dup
]
keep
-rot
]
[
2dup
=
[
[
1
+
]
when
seq slice-quot
call
]
2keep
[
1
+
]
when
swap
]
produce
nip
swap
seq
length
[
dupd
<
]
keep
[
seq slice-quot
call
suffix
]
curry
[
drop
]
if
;
inline