[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] functions for hash tables
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] functions for hash tables |
Date: |
Thu, 27 Jan 2005 22:06:14 +0100 |
On Thu, 27 Jan 2005 21:48:08 +0100 (CET),
address@hidden <address@hidden>
wrote:
> On 27 Jan 2005, felix winkelmann <address@hidden> wrote:
> > > 1.
> > > hash-table-update! is missing (although important).
> >
> > If I understand this correctly, it's hash-table-set! with an update
> > function,
> > right?
>
> Yes.
>
> > Is this really that useful?
>
> Without such a function, each modification of a hash table's value would
> require two calls:
>
> hash-table-ref
> AND
> hash-table-set!
> (which calculates the hash for the key twice,
> some more complications if the key is not in the hash table).
Ah, now I understand. Consider this implemented.
>
> > > 3.
> > > hash-table-ref is called hash-table-get in all other implementations.
> >
> > Hm, I prefer -ref and -set!.
>
> Ok. I see that many people want Chicken to be avantgard :-) Why not?
> But there is a small asymmetry:
> -ref and -set! work with numerical "keys" whose values _always exist_ in
> the given list/string/vector (otherwise an error would be triggered) -
> while -put! might legally create a new key-value pair
> and -get returns for a nonexisting key _without_ an error.
One could just as well consider a hash-table to be a vector with an
unbounded number of elements...
Anyway, I'm not going into deep philosophical discussions about this.
-ref and -set! is what I'm used to in Scheme, when fetching/storing something
in a data structure.
cheers,
felix
- Re: [Chicken-users] functions for hash tables, (continued)
- Re: [Chicken-users] functions for hash tables, Alex Shinn, 2005/01/27
- Re: [Chicken-users] functions for hash tables, Ed Watkeys, 2005/01/27
- Re: [Chicken-users] functions for hash tables, Benedikt Rosenau, 2005/01/27
- Re: [Chicken-users] functions for hash tables, Alex Shinn, 2005/01/27
- Re: [Chicken-users] functions for hash tables, Alex Shinn, 2005/01/28
Re: [Chicken-users] functions for hash tables, Andreas Rottmann, 2005/01/26
Re: [Chicken-users] functions for hash tables, felix winkelmann, 2005/01/27