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

Next:groups


Vocabulary
grouping

Inputs and outputs
seqa sequence
na non-negative integer
arraya sequence of sequences


Word description
Splits the sequence into disjoint groups of n elements and collects the groups into a new array.

Notes
If the sequence length is not a multiple of n, the final subsequence in the list will be shorter than n elements.

Examples
USING: grouping prettyprint ; { 3 1 3 3 7 } 2 group .
{ { 3 1 } { 3 3 } { 7 } }


See also
clump, circular-clump

Definition