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

Prev:clump ( seq n -- array )
Next:clumps


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, wrapping around the end of the sequence, and collects the clumps into a new array.

Notes
For an empty sequence, the result is an empty sequence.

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


See also
clump, group

Definition