guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how does hash table work?


From: Paul Jarc
Subject: Re: how does hash table work?
Date: Tue, 13 Apr 2004 23:39:11 -0400
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

"Steven Wu" <address@hidden> wrote:
> I tried to build a hash table with string as key and list as the
> value. I used (hashx-create-handle string-hash eqv? table key val),
> and it made it in to the table, however, I couldn't get the value
> out. Can somebody shed some light on this?

eqv? isn't the right kind of procedure for comparing keys.  assv is
the right kind, but probably isn't useful for string keys - unless you
use the exact same string object as the lookup key, you won't find the
record.  assoc would be useful.  But it would be more convenient to
use the hash-* procedures instead of hashx-*.

(hash-create-handle! tbl "key" '(value))
(hash-ref "key")


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]