summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-09-22 16:28:43 +0000
committerRich Hickey <richhickey@gmail.com>2008-09-22 16:28:43 +0000
commit96364b6620d1fff27d8cf683fc3315f89d955a67 (patch)
tree9daba74e29f03499f94313c923cf1b62bce9abda /src
parent946986785f6b28384d0cba68deef4623da20bf84 (diff)
added f arity 2 and 3 overloads for map
prefer-method print-method IPersistentList over ISeq
Diffstat (limited to 'src')
-rw-r--r--src/clj/clojure/boot.clj19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/clj/clojure/boot.clj b/src/clj/clojure/boot.clj
index de1dd033..54e3e857 100644
--- a/src/clj/clojure/boot.clj
+++ b/src/clj/clojure/boot.clj
@@ -1212,10 +1212,19 @@
([f coll]
(when (seq coll)
(lazy-cons (f (first coll)) (map f (rest coll)))))
- ([f coll & colls]
- (when (and (seq coll) (every? seq colls))
- (lazy-cons (apply f (first coll) (map first colls))
- (apply map f (rest coll) (map rest colls))))))
+ ([f c1 c2]
+ (when (and (seq c1) (seq c2))
+ (lazy-cons (f (first c1) (first c2))
+ (map f (rest c1) (rest c2)))))
+ ([f c1 c2 c3]
+ (when (and (seq c1) (seq c2) (seq c3))
+ (lazy-cons (f (first c1) (first c2) (first c3))
+ (map f (rest c1) (rest c2) (rest c3)))))
+ ([f c1 c2 c3 & colls]
+ (let [step (fn step [cs]
+ (when (every? seq cs)
+ (lazy-cons (map first cs) (step (map rest cs)))))]
+ (map #(apply f %) (step (conj colls c3 c2 c1))))))
(defn mapcat
"Returns the result of applying concat to the result of applying map
@@ -3399,6 +3408,8 @@
(print-meta o w)
(print-sequential "(" print-method " " ")" o w))
+(prefer-method print-method clojure.lang.IPersistentList clojure.lang.ISeq)
+
(def #^{:tag String
:doc "Returns escape string for char or nil if none"}
char-escape-string