Hi,

On Mar 8, 9:19 am, alux <alu...@googlemail.com> wrote:

> if I put the same keyword in a map literal multiple times, it seems to
> stay there somehow:
>
> user=> {:a 1 :a 2 :a 3}
> {:a 1, :a 2, :a 3}

This is an optimisation for small maps: the keys are not checked for
uniqueness. One has to distinguish array maps from hash maps. Array
maps are like ye olde alists. For small maps this is faster than a
real hash map. Clojure uses array maps for small map literals (up to
eight keys, IIRC). Having duplicate keys in a map literal is usually
considered a bug.

There is a ticket however, that map literals rely to much on the
reader. So maybe there might be a change here, but I'm not up to date
with that discussion.

Sincerely
Meikel

-- 
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