Handbook
Glossary
clumps
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Groups and clumps
Prev:
circular-clump ( seq n -- array )
Next:
<clumps> ( seq n -- clumps )
Vocabulary
grouping
Class description
Instances are virtual sequences whose elements are overlapping fixed-length subsequences of an underlying sequence. Clumps are mutable and resizable if the underlying sequence is mutable and resizable, respectively.
New clumps are created by calling
<clumps>
.
See also
circular-clumps
,
groups
Definition
USING:
grouping.private
;
IN:
grouping
TUPLE:
clumps
<
chunking
;
Methods
USING:
accessors
grouping
grouping.private
kernel
math
;
M:
clumps
group@
[
n>>
over
+
]
[
seq>>
]
bi
;
inline
USING:
accessors
grouping
kernel
math
math.order
sequences
;
M:
clumps
length
dup
seq>>
length
[
drop
0
]
[
swap
[
1
+
]
[
n>>
]
bi*
[-]
]
if-zero
;
inline
USING:
accessors
grouping
kernel
math
sequences
;
M:
clumps
set-length
[
n>>
+
1
-
]
[
seq>>
]
bi
set-length
;
inline