Handbook
Glossary
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
seq
a
sequence
n
a non-negative integer
Outputs
array
a 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
USING:
grouping.private
;
IN:
grouping
:
circular-clump
( seq n -- array )
[
<circular-clumps>
]
map-like
;
inline