Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-27 Thread Ludovic Courtès
Mark H Weaver skribis: > l...@gnu.org (Ludovic Courtès) writes: > >> Nala Ginrut skribis: >> >>> +(define (hash-keys table) >>> + "Return all the keys from hash table." >>> + (hash-map->list (lambda (x y) x) table)) >> >> That doesn’t seem sufficiently common to warrant a new procedure. WDYT?

Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-27 Thread Nala Ginrut
On Wed, Mar 27, 2013 at 9:33 PM, Mark H Weaver wrote: > l...@gnu.org (Ludovic Courtès) writes: > > > Nala Ginrut skribis: > > > >> +(define (hash-keys table) > >> + "Return all the keys from hash table." > >> + (hash-map->list (lambda (x y) x) table)) > > > > That doesn’t seem sufficiently com

Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-27 Thread Mark H Weaver
l...@gnu.org (Ludovic Courtès) writes: > Nala Ginrut skribis: > >> +(define (hash-keys table) >> + "Return all the keys from hash table." >> + (hash-map->list (lambda (x y) x) table)) > > That doesn’t seem sufficiently common to warrant a new procedure. WDYT? FWIW, I think it would be reasona

Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-27 Thread Nala Ginrut
hi Daniel! First, I'll appreciate your patience. ;-) On Wed, 2013-03-27 at 16:55 +0800, Daniel Hartwig wrote: > On 27 March 2013 14:32, Nala Ginrut wrote: > > On Wed, 2013-03-27 at 13:10 +0800, Daniel Hartwig wrote: > >> On 27 March 2013 08:47, Nala Ginrut wrote: > >> > > >> > 在 2013-3-27 AM5:5

Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-27 Thread Ludovic Courtès
Hi! Nala Ginrut skribis: > Well, could you point me out how can I get the amount of items with > hash-count in constant time? You can’t, but Daniel is arguing that this should not be needed in the first place, which makes sense to me. > IMO, return the count of inner record is most explicit wa

Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-27 Thread Daniel Hartwig
On 27 March 2013 14:32, Nala Ginrut wrote: > On Wed, 2013-03-27 at 13:10 +0800, Daniel Hartwig wrote: >> On 27 March 2013 08:47, Nala Ginrut wrote: >> > >> > 在 2013-3-27 AM5:59,"Ludovic Courtès" 写道: >> > >> > >> >> >> >> Nala Ginrut skribis: >> >> >> >> Hi now >> >> >> > * hash-items: get the am

Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-26 Thread Nala Ginrut
On Wed, 2013-03-27 at 13:10 +0800, Daniel Hartwig wrote: > On 27 March 2013 08:47, Nala Ginrut wrote: > > > > 在 2013-3-27 AM5:59,"Ludovic Courtès" 写道: > > > > > >> > >> Nala Ginrut skribis: > >> > > Hi now > > >> > * hash-items: get the amount of items in the hash table > >> > >> There’s alread

Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-26 Thread Daniel Hartwig
On 27 March 2013 08:47, Nala Ginrut wrote: > > 在 2013-3-27 AM5:59,"Ludovic Courtès" 写道: > > >> >> Nala Ginrut skribis: >> Hi now >> > * hash-items: get the amount of items in the hash table >> >> There’s already ‘hash-count’, recently added. >> > > If I need to check the amount of items > each

Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-26 Thread Nala Ginrut
在 2013-3-27 AM5:59,"Ludovic Courtès" 写道: > > Nala Ginrut skribis: > > > * hash-items: get the amount of items in the hash table > > There’s already ‘hash-count’, recently added. > If I need to check the amount of items each time in the loop, hash-count will do redundant visit for all items. But h

Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-26 Thread Ludovic Courtès
Nala Ginrut skribis: > * hash-items: get the amount of items in the hash table There’s already ‘hash-count’, recently added. > +SCM_DEFINE (scm_hash_size, "hash-size", 1, 0, 0, > +(SCM table), > +"Get the size of this hash table.") > +#define FUNC_NAME s_scm_hash_size >

Re: [PATCH] Add-native-hashtable-helper-functions

2013-03-26 Thread Noah Lavine
I would be afraid that without an entry in the manual, people won't know the functions exist, even if the docstrings are enough to explain what they do. Noah On Tue, Mar 26, 2013 at 6:40 AM, Nala Ginrut wrote: > Added three helper functions, they're so explicit that don't need any > docs in th

[PATCH] Add-native-hashtable-helper-functions

2013-03-26 Thread Nala Ginrut
nks! >From 167e82e93ee59ac9a0244006ae9664d68877b4c8 Mon Sep 17 00:00:00 2001 From: Nala Ginrut Date: Tue, 26 Mar 2013 16:00:54 +0800 Subject: [PATCH] Add native hashtable helper functions. libguile/hashtab.c: Add hash-items and hash-size libguile/hashtab.h module/ice-9/boot-9.scm: Add hash-keys