Hi Group,

I've just written an implementation of a persistent map which provides
a default value -- fixed at creation time the way it's currently
implemented -- and claims that it .containsKey every key thrown at it.
The code is here:

http://gist.github.com/468332

As mentioned in a comment, the small parts which aren't entirely
trivial are taken more or less directly from emit-defrecord (minus its
generic nature).

My primary purpose was to devise a helper map type for use with
merge-with, so that I can say

(merge-with conj (DefaultMap. [] {}) {:a 1} {:a 2} {:a 3})

and get back

{:a [1 2 3]}

Any comments? In particular, do the implementations of hashCode,
equals and getLookupThunk look alright?

Sincerely,
Michał

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