On 3 May 2010 16:13, Sean Devlin <[email protected]> wrote:
> These two fns are right next to each other in core:
>
> (defn hash-map
>  "keyval => key val
>  Returns a new hash map with supplied mappings."
>  ([] {})
>  ([& keyvals]
>   (. clojure.lang.PersistentHashMap (createWithCheck keyvals))))
>
> (defn hash-set
>  "Returns a new hash set with supplied keys."
>  ([] #{})
>  ([& keys]
>   (clojure.lang.PersistentHashSet/createWithCheck keys)))
>
> I'm curious why hash-map uses a form to createWithCheck, and hash-set
> uses a static method.

I suspect you'll find the answer by digging through the history of
those functions.

e.g.:

On Mon Apr 5 at 11:02:09 2010 -0400 Rich made the following change to
the hash-map function:

-   (. clojure.lang.PersistentHashMap (create keyvals))))
+   (. clojure.lang.PersistentHashMap (createWithCheck keyvals))))

Then at 11:23:55 2010 -0400 on the same day he made the following
change to the hash-set function:

-   (clojure.lang.PersistentHashSet/create keys)))
+   (clojure.lang.PersistentHashSet/createWithCheck keys)))

So it's easy to see why they look like they do now if you see how
those two changes were made and realise that the simplest change was
made in each case.  Of course, that raises the question of why they
were the way they were before these changes, but you'll have to do
your own digging to find that out :)

-- 
Michael Wood <[email protected]>

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

Reply via email to