On May 30, 2009, at 7:01 AM, Meikel Brandmeyer wrote:

If I remember correctly, map literals smaller
than a certain size are based on array-map.
For speed reasons, this does not check for
duplicate keys. If you increase the size of
your literal beyond the threshold (was it
something around twenty entries?) the map
will be a hash-map and the effect should
go away...

The threshold is currently 8, though that's an implementation detail, not a promise.

user=> {:foo 1 :foo 2 :foo 3 :foo 4 :foo 5 :foo 6 :foo 7 :foo 8}
{:foo 1, :foo 2, :foo 3, :foo 4, :foo 5, :foo 6, :foo 7, :foo 8}
user=> {:foo 1 :foo 2 :foo 3 :foo 4 :foo 5 :foo 6 :foo 7 :foo 8 :foo 9}
{:foo 9}

My understanding is, that this falls under
"do broken stuff and you'll get broken stuff".
Map literals are most-likely small maps with
hard-wired keys. So the chance to have a
map like above is very small. And if there is
one I would strongly question the correctness.

So this shouldn't be a real problem in practice.

+1

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to