unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: Re: [PATCH] Add-native-hashtable-helper-functions
Date: Tue, 26 Mar 2013 22:58:57 +0100	[thread overview]
Message-ID: <874nfxvn4u.fsf@gnu.org> (raw)
In-Reply-To: 1364294433.2730.2.camel@Renee-desktop.suse

Nala Ginrut <nalaginrut@gmail.com> 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’.




  parent reply	other threads:[~2013-03-26 21:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-26 10:40 [PATCH] Add-native-hashtable-helper-functions Nala Ginrut
2013-03-26 12:54 ` Noah Lavine
2013-03-26 21:58 ` Ludovic Courtès [this message]
2013-03-27  0:47   ` Nala Ginrut
2013-03-27  5:10     ` Daniel Hartwig
2013-03-27  6:32       ` Nala Ginrut
2013-03-27  8:55         ` Daniel Hartwig
2013-03-27 10:25           ` Nala Ginrut
2013-03-27 10:03         ` Ludovic Courtès
2013-03-27 13:33   ` Mark H Weaver
2013-03-27 13:55     ` Nala Ginrut
2013-03-27 20:21     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874nfxvn4u.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).