Here's why it would be useful to have the option of hash maps that use
identity...

Let's say my keys are rather long lists.  Equality comparison will be
slow.  But if I know that the keys are always the exact same long
lists (perhaps because I traversed the key sequence to find a key with
a certain property, and then am updating with that precise key as one
example), then I can save lots of time by using an identity
comparison.

FWIW, the Scheme I usually use (PLT Scheme) supports both eq? and
equal? based hash tables, and I have found both to be useful (although
I prefer equal? based hash tables as the default).

On Sat, Mar 7, 2009 at 7:57 AM, David Powell <djpow...@djpowell.net> wrote:
> What objects are you trying to store? The ideal in the Clojure world,
> is that most objects are immutable.
>
>  Immutable objects will implement value equality in .equals() ('=' in
>  Clojure), and you shouldn't care about whether two objects are
>  identical? because it won't affect anything.

It's an efficiency issue.

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