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

Next:groups


Vocabulary
grouping

Inputs
seqa sequence
na non-negative integer


Outputs
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