Skip to content

Commit 1e835a9

Browse files
committed
CLJ-2742 Revert range to use chunking as before the IDrop changes in CLJ-2713
1 parent 8adf5bc commit 1e835a9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/jvm/clojure/lang/LongRange.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,23 @@ public ISeq next() {
116116
}
117117
}
118118

119+
private static final int CHUNK_SIZE = 32;
120+
119121
public IChunk chunkedFirst() {
120-
return new LongChunk(start, step, count);
122+
return new LongChunk(start, step, Math.min(count, CHUNK_SIZE));
121123
}
122124

123125
public ISeq chunkedNext() {
124-
return null;
126+
return chunkedMore().seq();
125127
}
126128

127129
public ISeq chunkedMore() {
128-
return PersistentList.EMPTY;
130+
if(count <= CHUNK_SIZE) {
131+
return PersistentList.EMPTY;
132+
} else {
133+
return LongRange.create(start + (step * CHUNK_SIZE), end, step);
134+
}
135+
129136
}
130137

131138
public Sequential drop(int n) {

0 commit comments

Comments
 (0)