This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: how to work with (weak) hash tables?
- To: Valentin Kamyshenko <val at kamysh dot materials dot kiev dot ua>
- Subject: Re: how to work with (weak) hash tables?
- From: Greg Harvey <Greg dot Harvey at thezone dot net>
- Date: 23 Nov 1999 16:37:27 -0330
- Cc: guile mailing list <guile at sourceware dot cygnus dot com>
- References: <m2hfif1qp9.fsf@kamysh.materials.kiev.ua>
Valentin Kamyshenko <val@kamysh.materials.kiev.ua> writes:
> Hello,
>
> is there a way to loop over all members of (weak) hash table?
Sure. The easiest way (at least, what I think is the easiest way :) is
to convert it to an alist using hash-fold;
(define hash-table->alist
(lambda (tab)
(hash-fold acons () tab)))
Then you just do whatever you'd do for an alist.
> It seems to be necessary, for example, for saving/restoring hash
> tables (although my problem is different).
>
> Thank you in advance,
>
> --
> Best regards,
> Valentin.
>
>
--
Greg