guile-devel
[Top][All Lists]
Advanced

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

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


From: Ludovic Courtès
Subject: Re: [PATCH] Add-native-hashtable-helper-functions
Date: Tue, 26 Mar 2013 22:58:57 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Nala Ginrut <address@hidden> 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
> +{
> +  SCM_VALIDATE_HASHTABLE (1, table);
> +  return scm_from_uint (SCM_SIMPLE_VECTOR_LENGTH (SCM_HASHTABLE_VECTOR 
> (table)));

That returns the number of buckets, which is an internal detail, and
probably not a useful one.

> +(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?

Thanks,
Ludo’.




reply via email to

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