On 7 Aug., 10:07, Patrick Sullivan <wizardofwestma...@gmail.com>
wrote:
>
> Am I doing something silly here or is this a bug?

You probably are using conj! for the side-effect, but after growing
the hashmap to size 8 conj! returns a different map.

user> (def foo (transient {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
8}))
#'user/
foo
user> (class
foo)
clojure.lang.PersistentArrayMap
$TransientArrayMap
user> (def new-foo (conj! foo {9
9}))
#'user/new-
foo
user> (class
foo)
clojure.lang.PersistentArrayMap
$TransientArrayMap
user> (class new-
foo)
clojure.lang.PersistentHashMap
$TransientHashMap
user> (identical? foo new-
foo)
false
user> (def foo (conj! foo {9
9}))
#'user/
foo
user> (persistent!
foo)
{1 1, 2 2, 3 3, 4 4, 5 5, 6 6, 7 7, 8 8, 9
9}

remember to capture the return value of the modifying function calls.

Alex

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to