We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 71f5771 commit 6062744Copy full SHA for 6062744
2 files changed
src/main/cljs/cljs/core.cljs
@@ -9721,7 +9721,7 @@ reduces them without incurring seq initialization"
9721
(let [fst (first s)
9722
fv (f fst)
9723
run (cons fst (take-while #(= fv (f %)) (next s)))]
9724
- (cons run (partition-by f (seq (drop (count run) s)))))))))
+ (cons run (partition-by f (lazy-seq (drop (count run) s)))))))))
9725
9726
(defn frequencies
9727
"Returns a map from distinct items in coll to the number of times
src/test/cljs/cljs/seqs_test.cljs
@@ -216,3 +216,7 @@
216
(deftest test-cljs-2482
217
(testing "seq on defrecord returns map entries"
218
(is (every? map-entry? (seq (->Foo 1 2))))))
219
+
220
+(deftest test-cljs-2911
221
+ (testing "partition-by works correclty with infinite seqs"
222
+ (is (= (first (second (partition-by zero? (range)))) 1))))
0 commit comments