Created
June 17, 2011 10:00
-
-
Save raek/1031156 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmulti mutable type) | |
(defmethod mutable :default [x] | |
x) | |
(defmethod mutable clojure.lang.ISeq [coll] | |
(java.util.LinkedList. (map mutable coll))) | |
(defmethod mutable clojure.lang.IPersistentVector [coll] | |
(java.util.ArrayList. (map mutable coll))) | |
(defmethod mutable clojure.lang.IPersistentMap [m] | |
(java.util.HashMap. (zipmap (map mutable (keys m)) | |
(map mutable (vals m))))) | |
(defmethod mutable clojure.lang.IPersistentSet [coll] | |
(java.util.HashSet. (map mutable coll))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment