[stx-ified Panu Kalliokoski **20050224053046 Keywords: (atehwa@sange.fi--2005/hash-srfi--prod--1--patch-2) ] { move ./hash-srfi.html ./hash-srfi.stx hunk ./hash-srfi.stx 1 - - -SRFI ?: Basic hash tables +w_title(SRFI ?: Basic hash tables)dnl +w_author(Panu Kalliokoski)dnl +w_date(2005-02-24)dnl hunk ./hash-srfi.stx 5 - +! Author hunk ./hash-srfi.stx 7 -

Title

+defn(`@w_author'). hunk ./hash-srfi.stx 9 -Basic hash tables +! Abstract hunk ./hash-srfi.stx 11 -

Author

- -Panu Kalliokoski - -

Abstract

- -

This SRFI specifies an API for basic hash tables. Hash tables are -data structures that typically provide a mapping from some set of keys -to some set of values associated to those keys. Hash tables have no +This SRFI specifies an API for basic hash tables. Hash tables are data +structures that typically provide a mapping from some set of keys to +some set of values associated to those keys. Hash tables have no hunk ./hash-srfi.stx 17 -

Issues

+! Issues hunk ./hash-srfi.stx 19 -

There is no single best way to make hash tables. The tables -presented in this SRFI aim at being both conceptually simple and usable -for a wide variety of applications. Even though a portable -implementation is provided, Scheme implementations can speed things up -considerably by e.g. providing an internal hash function for symbols. -Moreover, almost every Scheme implementation already has some kind of -low-level hash table functionality, because that's the natural way to -implement namespaces, and specifically, to provide support for -string->symbol. There might be some benefit in -integration between implementation-specific namespaces and the hash -table API presented here; however, these issues are left open. +There is no single best way to make hash tables. The tables presented +in this SRFI aim at being both conceptually simple and usable for a wide +variety of applications. Even though a portable implementation is +provided, Scheme implementations can speed things up considerably by +e.g. providing an internal hash function for symbols. Moreover, almost +every Scheme implementation already has some kind of low-level hash +table functionality, because that's the natural way to implement +namespaces, and specifically, to provide support for ''string->symbol''. +There might be some benefit in integration between +implementation-specific namespaces and the hash table API presented +here; however, these issues are left open. hunk ./hash-srfi.stx 31 -

Rationale

+! Rationale hunk ./hash-srfi.stx 33 -

Hash tables are widely recognised as a fundamental data structure for +Hash tables are widely recognised as a fundamental data structure for hunk ./hash-srfi.stx 37 -

Alas, although similar, these hash table APIs have many differences: +Alas, although similar, these hash table APIs have many differences: hunk ./hash-srfi.stx 46 -

The primary aim of this SRFI is to provide a simple and generic hash +The primary aim of this SRFI is to provide a simple and generic hash hunk ./hash-srfi.stx 51 -

Specification

+! Specification hunk ./hash-srfi.stx 53 -

Names defined in this SRFI: +Names defined in this SRFI: hunk ./hash-srfi.stx 55 -

-
Basic type handlers
-
make-hash-table, hash-table?
-
Dealing with single elements
-
hash-table-ref, hash-table-get, hash-table-set!, hash-table-put!, hash-table-delete!, hash-table-remove!, hash-table-exists?
-
Dealing with the whole contents
-
hash-table-count, hash-table-keys, hash-table-values, hash-table-map, hash-table-for-each, hash-table-fold, hash-table->list
-
Hashing
-
hash, string-hash
-
+Basic type handlers:: hunk ./hash-srfi.stx 57 -

Implementation

+ [make-hash-table], [hash-table?] hunk ./hash-srfi.stx 59 +Dealing with single elements:: + + [hash-table-ref], [hash-table-get], [hash-table-set!], + [hash-table-put!], [hash-table-delete!], [hash-table-remove!], + [hash-table-exists?] + +Dealing with the whole contents:: + + [hash-table-count], [hash-table-keys], [hash-table-values], + [hash-table-map], [hash-table-for-each], [hash-table-fold], + [hash-table->list] + +Hashing:: + + [hash], [string-hash] + +! Implementation + hunk ./hash-srfi.stx 80 -??? explanation of how it meets the reference implementation requirement, and the code, if possible +??? explanation of how it meets the reference implementation +requirement, and the code, if possible hunk ./hash-srfi.stx 83 -Source for the reference implementation. +w_link(http://srfi.schemers.org/srfi-???-reference.scm, Source for the +reference implementation.) hunk ./hash-srfi.stx 86 -

Copyright

-Copyright (C) ??? (199?). All Rights Reserved. -

+! Copyright + +Copyright (C) defn(`@w_author') (2005). All Rights Reserved. + hunk ./hash-srfi.stx 91 -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: -

-The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. -

-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: hunk ./hash-srfi.stx 98 -


-
Editor: Dave Mason
- - -Last modified: Sat Oct 9 17:43:25 EDT 1999 - - +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + }