I've found myself writing (reduce into coll [coll1 coll2 coll3]) a few
times. It would be nice to instead write (into coll coll1 coll2 coll3),
like (+ 1 2 3) and other similar forms. I've attached a trivial patch
that works for me.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
index 8da29d1..2660f5e 100644
--- a/src/clj/clojure/core.clj
+++ b/src/clj/clojure/core.clj
@@ -1587,11 +1587,13 @@
(defn into
"Returns a new coll consisting of to-coll with all of the items of
from-coll conjoined."
- [to from]
- (let [ret to items (seq from)]
- (if items
- (recur (conj ret (first items)) (rest items))
- ret)))
+ ([to from]
+ (let [ret to items (seq from)]
+ (if items
+ (recur (conj ret (first items)) (rest items))
+ ret)))
+ ([to from & more-froms]
+ (reduce into to (cons from more-froms))))
(defn #^{:private true}
array [& items]