From 936705a2dfbe574ac643d166bfb98a1a600b2ff0 Mon Sep 17 00:00:00 2001 From: Rich Hickey Date: Sat, 18 Jul 2009 12:17:11 -0400 Subject: redef into with batch support --- src/clj/clojure/core.clj | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index 6e8ed1bb..ca000810 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -4360,3 +4360,18 @@ "Returns the value mapped to key, nil if key not present." [#^clojure.lang.IMutableAssociative coll key] (.valAt coll key)) + +;redef into with batch support +(defn into + "Returns a new coll consisting of to-coll with all of the items of + from-coll conjoined." + [to from] + (if (instance? clojure.lang.IEditableCollection to) + (#(loop [ret (mutable to) items (seq from)] + (if items + (recur (conj! ret (first items)) (next items)) + (immutable! ret)))) + (#(loop [ret to items (seq from)] + (if items + (recur (conj ret (first items)) (next items)) + ret))))) -- cgit v1.2.3-70-g09d2