ground cases for maps of zero colls #20

Closed
wants to merge 1 commit into
from
@@ -2421,6 +2421,7 @@
f should accept number-of-colls arguments."
{:added "1.0"
:static true}
+ ([f] ())
([f coll]
(lazy-seq
(when-let [s (seq coll)]
@@ -6050,6 +6051,7 @@
f should accept number-of-colls arguments."
{:added "1.4"
:static true}
+ ([f] [])
([f coll]
(-> (reduce (fn [v o] (conj! v (f o))) (transient []) coll)
persistent!))
@@ -6164,6 +6166,7 @@
the coordination overhead."
{:added "1.0"
:static true}
+ ([f] ())
([f coll]
(let [n (+ 2 (.. Runtime getRuntime availableProcessors))
rets (map #(future (f %)) coll)
@@ -23,6 +23,10 @@
;; pmap
;;
+;;
+(deftest pmap-no-colls
+ (is (= () (pmap +))))
+
(deftest pmap-does-its-thing
;; regression fixed in r1218; was OutOfMemoryError
(is (= '(1) (pmap inc [0]))))
@@ -18,6 +18,12 @@
; apply, map, filter, remove
; and more...
+(deftest test-map
+ (is (= () (map +))))
+
+(deftest test-mapcat
+ (is (= () (mapcat +))))
+
(deftest test-reduce-from-chunked-into-unchunked
(= [1 2 \a \b] (into [] (concat [1 2] "ab"))))
@@ -357,6 +357,8 @@
[expected v] (and (vector? v) (= expected v)))
(deftest test-mapv
+ (are [r] (=vec r (mapv +))
+ [])
(are [r c1] (=vec r (mapv + c1))
[1 2 3] [1 2 3])
(are [r c1 c2] (=vec r (mapv + c1 c2))