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

Prev:<groups> ( seq n -- groups )
Next:circular-clump ( seq n -- array )


Vocabulary
grouping

Inputs
seqa sequence
na non-negative integer


Outputs
arraya sequence of sequences


Word description
Splits the sequence into overlapping clumps of n elements and collects the clumps into a new array.

Notes
For an empty sequence, the result is an empty sequence. For a non empty sequence with a length smaller than n, the result will be an empty sequence.

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


See also
circular-clump, group

Definition