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: Michael Livshin <cmm at verisity dot com>
- Date: 24 Nov 1999 23:22:54 +0200
- Cc: guile at sourceware dot cygnus dot com
- Organization: who? me?
- References: <m2hfif1qp9.fsf@kamysh.materials.kiev.ua>
Valentin Kamyshenko <val@kamysh.materials.kiev.ua> writes:
> is there a way to loop over all members of (weak) hash table?
sorry if I'm late, but anyway.
the function that you need is called `hash-fold'.
(define ht (make-hash-table 7))
(hashq-set! ht 'a 1)
(hashq-set! ht 'b 2)
(hash-fold (lambda (key value acc)
(display (list key value))
(newline)
(+ 1 acc))
0 ht)
===>
(a 1)
(b 2)
2
> Valentin.
--mike
--
Politics is non-euclidean. -- Robert Anton Wilson