<groups> ( seq n -- groups )
Factor handbook > The language > Collections > Sequence operations > Groups and clumps

Prev: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 <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 <groups> second .
T{ slice { from 3 } { to 6 } { seq { 1 2 3 4 5 6 } } }


See also
<clumps>, <circular-clumps>

Definition