Composite keys in Dictionary
Daniel John Crowe
s2007517 at student.rmit.edu.au
Sun Sep 26 19:52:09 PDT 2004
Thanks, that should fix it.
-----Original Message-----
From: Lee Salzman <lsalzman1 at cox.net>
To: s2007517 at student.rmit.edu.au, Slate project discussion <slate at tunes.org>
Date: Sun, 26 Sep 2004 19:00:01 -0700
Subject: Re: Composite keys in Dictionary
This is from a bug in hashing Sequences that was fixed in CVS but is
still present in the 0.3 release.
If you don't feel like going through the trouble of upgrading from CVS,
you can just add the following method to your private image:
c@(Sequence traits) hash
[| hash |
hash: c traits identityHash.
c doWithIndex: [| :each :index | hash: (hash + each hash) hashMultiply].
hash
].
On Sun, Sep 26, 2004 at 07:44:04PM +1000, Daniel John Crowe wrote:
>
>
> Hi,
>
> I'm just introducing myself to the slate world (0.3) and I've come up against an issue.
>
> I've been trying to add composite keys to a dictionary.
> ie: dict at: (keya , keyb) put: val.
>
> The dictionary uses an identity hash on the tuple, and this prevents me from using a new tuple to read the value from the dictionary.
>
> ie: dict at: (keya, keyb). "fails"
>
> What is the best way around this?
>
> Thanks, Daniel Crowe.
>
>
>
More information about the Slate
mailing list