SRFI-69: hash-table-size Sven.Hartrumpf@xxxxxx (04 Aug 2005 13:56 UTC)
Re: SRFI-69: hash-table-size Scott G. Miller (04 Aug 2005 14:45 UTC)
Re: SRFI-69: hash-table-size David Van Horn (04 Aug 2005 15:18 UTC)
Re: SRFI-69: hash-table-size Panu (04 Aug 2005 17:11 UTC)

Re: SRFI-69: hash-table-size David Van Horn 04 Aug 2005 15:04 UTC

xxxxxx@fernuni-hagen.de wrote:
> Hi Felix and Panu, dear list readers.
>
> If I understand correctly, we have this confusing mixture:
>
>    chicken           SRFI-69          meaning
>
> 1. hash-table-size   -                number of buckets or so
> 2. hash-table-count  hash-table-size  number of associations

> Any more preexisting "naming art"?

Many Schemes implement hash tables, but I've found no other Scheme providing a
number of buckets operation.  Of the Schemes that have a number of
associations operation, the names vary highly.  A survey of the naming
conventions follows below.  SRFI 44 Collections speaks to this issue with the
following:

    Size versus Length

    Most collections possess a concept of size. The size of a collection is the
    number of values or mappings it currently contains. This differs from the
    concept of length in Scheme datastructures, which corresponds to the number
    of cons cells or vector slots the structure contains. A collection may
    contain more cells or slots than required to contain its values or
    mappings. An example might be a hashtable collection, which may at any
    given time contain numerous unoccupied, discontiguous cells. This matter is
    confused by the collections specified in this API, whose size and length
    are the same.

    Put another way, collection-size should return the number of enumeration
    steps that will occur, if known.

According to the SRFI 44 terminology, hash-table-size is the correct name for
the number of associations, and SRFI 69 has it right.  However, as stated in
the document, "This SRFI does not conform to the interface of maps presented
in SRFI 44."  So clearly conforming to SRFI 44 is not a priority of the author.

In alphabetic order of the non-broken links to Scheme implementations from
Scheme Systems Supporting SRFIs (besides Chicken, which you've covered):

Bigloo
------

hashtable-size table	bigloo procedure
Returns the number of entries contained in table.

Chez
----

[Has a hash table data type, but no size/length operation]

Gauche
------

Function: hash-table-num-entries ht
     Returns the number of entries in the hash table ht.

Guile
-----

[Has a hash table data type, but no size/length operation]

Kawa
----

[Kawa has no hash table data type]

Scheme 48
---------

[Has a hash table data type, but no size/length operation]

Larceny
-------

[From scanning larceny_src/Docs, I see no hash table data type]

PLT
---

(hash-table-count hash-table) returns the number of keys mapped by hash-table.
If hash-table is not created with 'weak, then the result is computed in
constant time and atomically. If hash-table is created with 'weak, see the
caveat below about concurrent modification.

RScheme
-------

table-size -- Computes the number of keys in the table.

SCM
---

[Doesn't appear to have a hash table data type, but supports SLIB which does.]

Scsh
----

[Uses Scheme 48 hash tables]

SISC
----

procedure:  (hashtable/size hashtable) => number

     Returns the number of key/value pairs stored in hashtable.

SLIB
----

[Has a hash table data type, but no size/length operation]

SXM
---

[I could find no documentation]