help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Hash tables - how to look up values?


From: Thorsten Jolitz
Subject: Re: Hash tables - how to look up values?
Date: Wed, 04 Jul 2012 16:31:02 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.0.93 (gnu/linux)

Bastien <bzg@gnu.org> writes:

Hi Bastien,

>> I could not find such a function - does it exist already?
>
> I don't think so.  But here is a start:
>
> (let (key-found)
>   (maphash (lambda (key val)
>            (when (equal val "my_value")
>              (setq key-found key)))
>          hashtest)
>   key-found)
>
> Of course, the shortcoming is that it stops at the first key it finds,
> and discards multiple keys if several have the same value.

Thanks, now I even have the 'agony of choice' (is that how they call it
in English?), but I might very well need both solutions - return the
first or all values found.

-- 
cheers,
Thorsten




reply via email to

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