[plt-scheme] likely -> incompatibility: hash tables

From: Stephen De Gabrielle (stephen at degabrielle.name)
Date: Tue Apr 8 17:54:50 EDT 2008


I suppose a 'mapping' or 'mapper' is right out due to the map fuction. (and
would hash-table-map become map-mapping or map-mapper ?)

'Index' comes to mind,  (ie a book index associates terms, with a page
number reference)

Table is one of those overloaded words, and while shorter than dictionary,
doesn't really tell you anything about the actual thing referred too. (table
actually makes me think of database tables with named columns, dictionary is
not much better)

What are they called in lisp or haskell?



On Mon, Apr 7, 2008 at
 10:31 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:

> While we're cleaning up the language in v4, we'd like to do something
> about the API for using hash tables:
>  * The names `hash-table-get' and `hash-table-put!' are long enough to
>   be annoying.
>  * The names don't follow the usual `-ref' and `-set!' covention. (I
>   always have trouble remembering that it's `hash-table-put!', not
>   `hash-table-set!'.)
>  * We'd like more things to have the same API, such as a dictionary
>   that provides constant-time functional update.
> Here's the current plan to deal with those problems:
>  * Change `hash-table-get' to `table-ref'.
>  * Change hash-table-put!' to `table-set!'.
>  * Change "hash-table" in most other function names to just "table":
>   `hash-table-count' -> `table-count'.
>  * Add some property for creating new kinds of tables. The property
>   value supplies an implementation for `table-ref', etc.
>  * Leave the name `make-hash-table' and `make-immutable-hash-table' as
>   they are, on the grounds that they create a specific kind of table.
>   Also leave the `#hash' and `#hasheq' notations alone. Keep
>   `hash-table?', but also add `table?'.
>  * Add `hash-table-set' (no "!"), which takes an table and functionally
>   produces an extended one. Immutable hash tables would support this
>   operation, and mutables one wouldn't. Note that `#hash()' and
>   `#hasheq()' become useful base cases for inductively building up a
>   table with `hash-table-set'.
>  * Add `table-remove', the functional complement of `table-remove!'.
>  * Add `for/table', which builds an immutable hash table.
> Since lots of `hash-table-...' functions change names in `scheme/base',
> this will break lots of v3.99 code. (Of course, the `mzscheme' module
> would export the old names.) We'd also have to pick a new name for the
> `table' datatype in Scribble, and no doubt in other places.
> It's a late in the v3.99 series to make changes like this, but tables
> seem important enough to do it anyway --- and important enough to favor
> this change over hundreds of other potential improvements that won't
> happen in v4.
> This plan is tentative, but it will happen very soon if we don't
> discover serious problems with it.
> Matthew
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Stephen De Gabrielle
s.degabrielle at ucl.ac.uk
Telephone +44 (0)20 7679 5242 (x45242)
Mobile 079 851 890 45
Project: Making Sense of Information (MaSI)

UCLIC: University College London Interaction Centre

Remax House - 31/32 Alfred Place
London - WC1E 7DP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080408/afd3e9d5/attachment.html>

Posted on the users mailing list.