Created
June 4, 2012 18:56
-
-
Save mnylen/2870176 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
(def x (transient {})) | |
(conj! x [\A 1]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f> | |
(conj! x [\B 2]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f> | |
(conj! x [\C 3]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f> | |
(conj! x [\D 4]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f> | |
(conj! x [\E 5]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f> | |
(conj! x [\F 6]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f> | |
(conj! x [\G 7]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f> | |
(conj! x [\H 8]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f> | |
(conj! x [\I 9]) ;; => #<TransientHashMap clojure.lang.PersistentHashMap$TransientHashMap@77aa13c5> | |
(conj! x [\J 10]) ;; => #<TransientHashMap clojure.lang.PersistentHashMap$TransientHashMap@34f5b235> | |
(persistent! x) ;; => {\A 1, \B 2, \C 3, \D 4, \E 5, \F 6, \G 7, \H 8} | |
;; Note how the \I and \J keys are missing from the resulting map | |
;; Also, note that the result from (conj! x [\I 9]) is a different transient map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment