Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (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
Add Comment
Please, Sign In to add comment