On Sat, Jan 3, 2009 at 1:30 PM, Jason <jawo...@berkeley.edu> wrote:

> Thanks for your posts.  I think I understand what happens now, but I
> still maintain that it's a bug.  In particular, the Java API says: "If
> two objects are equal according to the equals(Object) method, then
> calling the hashCode method on each of the two objects must produce
> the same integer result."  This contract is clearly violated by
> the .hashCode and .equals methods for Clojure vectors and lists:
>
> user> (.equals [1 2] '(1 2))
> true
> user> (list (.hashCode [1 2]) (.hashCode '(1 2)))
> (994 -1919631597)
>
> Cheers, Jason
> >
>
I agree.  This does not seem right:

user> (= [1 2] '(1 2))
true
user> (map #(contains? (hash-set [1 2]) %) '((1 2) [1 2]))
(false true)

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