File tree Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -2204,6 +2204,14 @@ reduces them without incurring seq initialization"
2204
2204
()
2205
2205
more)))
2206
2206
2207
+ INext
2208
+ (-next [coll]
2209
+ (if (> (-count chunk) 1 )
2210
+ (ChunkedCons. (-drop-first chunk) more meta nil )
2211
+ (let [more (-seq more)]
2212
+ (when-not (nil? more)
2213
+ more))))
2214
+
2207
2215
IChunkedSeq
2208
2216
(-chunked-first [coll] chunk)
2209
2217
(-chunked-rest [coll]
@@ -6157,16 +6165,19 @@ reduces them without incurring seq initialization"
6157
6165
(defn set
6158
6166
" Returns a set of the distinct elements of coll."
6159
6167
[coll]
6160
- (if-not (nil? coll)
6161
- (let [^not-native in (seq coll)]
6162
- (if (instance? IndexedSeq in)
6163
- (set-from-indexed-seq in)
6164
- (loop [in in
6165
- ^not-native out (-as-transient #{})]
6166
- (if-not (nil? in)
6167
- (recur (-next in) (-conj! out (-first in)))
6168
- (-persistent! out)))))
6169
- #{}))
6168
+ (let [^not-native in (seq coll)]
6169
+ (cond
6170
+ (nil? in) #{}
6171
+
6172
+ (instance? IndexedSeq in)
6173
+ (set-from-indexed-seq in)
6174
+
6175
+ :else
6176
+ (loop [in in
6177
+ ^not-native out (-as-transient #{})]
6178
+ (if-not (nil? in)
6179
+ (recur (-next in) (-conj! out (-first in)))
6180
+ (-persistent! out))))))
6170
6181
6171
6182
(defn hash-set
6172
6183
([] #{})
Original file line number Diff line number Diff line change 1938
1938
(assert (= #{1 2 } (hash-set 1 2 2 )))
1939
1939
(assert (= #{1 2 } (apply hash-set [1 2 2 ])))
1940
1940
1941
+ ; ; CLJS-585
1942
+ (assert (= (last (map identity (into [] (range 32 )))) 31 ))
1943
+ (assert (= (into #{} (range 32 ))
1944
+ (set (map identity (into [] (range 32 ))))))
1945
+
1941
1946
:ok
1942
1947
)
You can’t perform that action at this time.
0 commit comments