<sliced-groups> ( seq n -- groups )
Factor documentation > Factor handbook > The language > Collections > Sequence operations > Groups and clumps
Prev:<groups> ( seq n -- groups )
Next:clump ( seq n -- array )


Vocabulary
grouping

Inputs and outputs
seqa sequence
na non-negative integer
groupsa groups


Word description
Outputs a virtual sequence whose elements are slices of disjoint subsequences of n elements from the underlying sequence.

Examples
USING: arrays kernel prettyprint sequences grouping ; 9 iota >array 3 <sliced-groups> dup [ reverse! drop ] each concat >array .
{ 2 1 0 5 4 3 8 7 6 }

USING: kernel prettyprint sequences grouping ; { 1 2 3 4 5 6 } 3 <sliced-groups> second .
T{ slice { from 3 } { to 6 } { seq { 1 2 3 4 5 6 } } }


See also
<sliced-clumps>, <sliced-circular-clumps>

Definition
USING: grouping.private ;

IN: grouping

: <sliced-groups> ( seq n -- groups )
sliced-groups new-groups ; inline