I am surprised that a map literal is clojure.lang.PersistentArrayMap but as
soon as I assign it to a var, it becomes clojure.lang.PersistentHashMap.
Are there any rules for being able to predict when these conversions occur?
user> (type {})
clojure.lang.PersistentArrayMap
user> (type {:what "why?"})
clojure.lang.PersistentArrayMap
user> (def curious {:what "why?"})
#'user/curious
user> (type curious)
clojure.lang.PersistentHashMap
user> (def sug (assoc curious :whodoneit "mikey"))
#'user/sug
user> (type sug)
clojure.lang.PersistentHashMap
I am curious because I wrote a (reduce) function which mostly just builds a
map:
(assoc map-of-data (:item-name next-item) next-item))
Since I was using assoc I was certain I would
get clojure.lang.PersistentHashMap back, but instead I
got clojure.lang.PersistentArrayMap.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.