Guest User

Untitled

a guest
Oct 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. (def x (transient {}))
  2. (conj! x [\A 1]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f>
  3. (conj! x [\B 2]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f>
  4. (conj! x [\C 3]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f>
  5. (conj! x [\D 4]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f>
  6. (conj! x [\E 5]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f>
  7. (conj! x [\F 6]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f>
  8. (conj! x [\G 7]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f>
  9. (conj! x [\H 8]) ;; => #<TransientArrayMap clojure.lang.PersistentArrayMap$TransientArrayMap@646dee9f>
  10. (conj! x [\I 9]) ;; => #<TransientHashMap clojure.lang.PersistentHashMap$TransientHashMap@77aa13c5>
  11. (conj! x [\J 10]) ;; => #<TransientHashMap clojure.lang.PersistentHashMap$TransientHashMap@34f5b235>
  12. (persistent! x) ;; => {\A 1, \B 2, \C 3, \D 4, \E 5, \F 6, \G 7, \H 8}
  13.  
  14. ;; Note how the \I and \J keys are missing from the resulting map
  15. ;; Also, note that the result from (conj! x [\I 9]) is a different transient map
Add Comment
Please, Sign In to add comment