Skip to content

Commit

Permalink
prevent vec from creating arrays from Collections
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed Jul 20, 2009
1 parent 936705a commit a3de8ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/clj/clojure/core.clj
Expand Up @@ -251,7 +251,9 @@
(defn vec
"Creates a new vector containing the contents of coll."
([coll]
(. clojure.lang.LazilyPersistentVector (createOwning (to-array coll)))))
(if (instance? java.util.Collection coll)
(clojure.lang.LazilyPersistentVector/create coll)
(. clojure.lang.LazilyPersistentVector (createOwning (to-array coll))))))

(defn hash-map
"keyval => key val
Expand Down

0 comments on commit a3de8ac

Please sign in to comment.