monotonic-split-impl ( seq quot slice-quot n -- pieces )


Vocabulary
splitting.monotonic.private

Inputs
seqan object
quotan object
slice-quotan object
nan object


Outputs
piecesan object


Definition


:: monotonic-split-impl ( seq quot slice-quot n -- pieces )
V{ } clone :> accum 0 0 seq
[ ] [
[ 1 + ] 2dip [
quot call
[ [ seq slice-quot call accum push ] keep dup ]
unless
] keep
] map-reduce drop n =
[ drop ] [ n seq slice-quot call accum push ] if accum
{ } like ; inline