(def a (BigInteger. "123"))
(= a 123)    ; this prints true
(= (hash a) (hash 123))  ; this also prints true

So how come (count #{a 123}) prints 2 ?

I'm aware that a and 123 have different types, but I was under the
impression that the hash set implementation was supposed to just rely
on hash codes and equality.  Why does the type come into play, and is
this really the desired behavior?

If this is the way it's supposed to work, then I'll probably add a
"normalize" function to the math library which reduces an integer down
to the correct Clojure type to avoid these sorts of problems when
interoperating with other libraries and using results from other
libraries in sets and maps.

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