On Sun, Mar 8, 2009 at 9:28 PM, Rich Hickey wrote:
>
> On Mar 8, 6:17 am, David Powell wrote:
>> > Identity is tested first in equality, if identical, equal, full stop.
>>
>> That's what I'd assumed (it's what the JDK collections do), but
>> looking at the code, to say, APersistentVectory, I can
On Mar 8, 6:17 am, David Powell wrote:
> > Identity is tested first in equality, if identical, equal, full stop.
>
> That's what I'd assumed (it's what the JDK collections do), but
> looking at the code, to say, APersistentVectory, I can't see where the
> identity test is done? Am I looking in
On Mar 7, 2009, at 8:30 PM, Mark Engelberg wrote:
But if the key is a long list, wouldn't it have to traverse the list
just to come up with the hash code for that list?
Yes, but only once. Since Clojure lists are immutable, their hash code
is calculated once and cached and the cache will ne
On Mar 7, 2009, at 8:30 PM, Mark Engelberg wrote:
>
> On Sat, Mar 7, 2009 at 2:57 PM, Rich Hickey
> wrote:
>> Identity is tested first in equality, if identical, equal, full stop.
>> So if you are using identical and unique collections as keys you'll
>> find them without a value-by-value comp
On Sat, Mar 7, 2009 at 2:57 PM, Rich Hickey wrote:
> Identity is tested first in equality, if identical, equal, full stop.
> So if you are using identical and unique collections as keys you'll
> find them without a value-by-value comparison. If they are not
> present, it's unlikely you'll get a m
On Mar 7, 3:44 pm, Mark Engelberg wrote:
> 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
Depending on what you are doing perhaps you could use (hash x). This might
not be very helpful if you need to update keys frequently. However if
you're mostly doing lookups, then this would help quite a bit.
On Sat, Mar 7, 2009 at 3:44 PM, Mark Engelberg wrote:
>
> Here's why it would be useful t
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 certa
> Is there a variation of hash-map which supports comparison of keys
> using identical? rather than = ? Ditto with sets.
There is java.util.IdentityHashMap, but it is mutable.
What objects are you trying to store? The ideal in the Clojure world,
is that most objects are immutable.
Immutable
java.util.IdentityHashMap
On Sat, Mar 7, 2009 at 1:49 AM, Mark Engelberg wrote:
>
> Is there a variation of hash-map which supports comparison of keys
> using identical? rather than = ? Ditto with sets.
>
> >
>
--~--~-~--~~~---~--~~
You received this message beca
10 matches
Mail list logo