On 5 April 2013 06:21, Taylan Ulrich B. <[email protected]> wrote: > Panicz Maciej Godek <[email protected]> writes: > >> Plainly, the size is kept in the internal representation of the hash >> table: >> >> typedef struct scm_t_hashtable { >> unsigned long n_items; /* number of items in table */ >> ... >> >> cf. >> http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=libguile/hashtab. >> h;h=82ed22e66eb1f5045793cfc55cca0be040d4aab1;hb=HEAD#l66 >> >> It would be really cheap&easy to get it from there. I just wanted to >> show that hash-tables are neglected in Scheme in general, and in Guile >> in particular. > > That sounds nasty indeed. It's late for me today; if no one's quicker > than me, tomorrow I might see that I implement hash-size in C as my > first Guile-contribution. :P >
Note that exposing a constant-time “number of items” operation has been proposed several times recently and remains not included. Please read the previous threads before proposing this yet again. Regards
