1. srfi-125
    1. Usage
    2. Hash Table Procedures
      1. make-hash-table
      2. hash-table-size-limit
      3. hash-table-equivalence-function
      4. hash-table-min-load
      5. hash-table-max-load
      6. hash-table-weak-keys
      7. hash-table-weak-values
      8. hash-table-mutable?
      9. hash-table-ephemeral-keys
      10. hash-table-ephemeral-values
      11. hash-table-has-initial?
      12. hash-table-initial
      13. hash-table-key-vector
      14. hash-table-value-vector
      15. hash-table-entries
      16. hash-table-vectors
      17. hash-table->plist
      18. hash-table-clean!
    3. Hashing Functions
      1. Usage
    4. Author
    5. Repository
    6. Requirements
    7. Version History
    8. License

srfi-125

This egg CANNOT coexist with srfi-69-weak. Uninstall it before installing this egg.

An implementation of SRFI 125 with SRFI 90 extensions. For more information, see SRFI-125 and SRFI-90.

Only the deviations from the SRFI are documented below, otherwise follow SRFI-125.

immutable copy
A hash-table is always mutable?.
duplicate keys
Allowed in alist & plist contexts; LIFO rules.

Usage

(import (srfi 125))
(import (srfi 69 hash) (srfi 125 strong))
(import (srfi 69 hash) (srfi 125 weak var))
(import (srfi 69 hash) (srfi 125 weak fix))
(import (srfi 125 introspection))

Hash Table Procedures

make-hash-table

[procedure] (make-hash-table [COMPARATOR | TEST [HASH]] [SIZE] ['weak-keys] ['weak-values] [#:test TEST] [#:hash HASH] [#:size SIZE] [#:initial INITIAL] [#:min-load MIN-LOAD] [#:max-load MAX-LOAD] [#:weak-keys WEAK-KEYS] [#:weak-values WEAK-VALUES])

Returns a new HASH-TABLE with the supplied configuration.

COMPARATOR
<comparator> ; (srfi 128) comparator.
TEST
(* * -> *) ; equivalence function.
HASH
(* [fixnum ...] -> fixnum) ; hash function.
SIZE
fixnum ; expected number of table elements.
INITIAL
* ; default initial value.
MIN-LOAD
flonum(0.0 1.0) ; minimum load factor.
MAX-LOAD
flonum(0.0 1.0) ; maximum load factor.
WEAK-KEYS
boolean ; weak references for keys.
WEAK-VALUES
boolean ; weak references for values.

Please note that hash tables are not guaranteed to compare equal? to each other, even if they contain exactly the same key/value pairs.

hash-table-size-limit

[procedure] (hash-table-size-limit HASH-TABLE)

The HASH-TABLE size-limit. The returned exact non-negative integer is the count of associations in a table that holds data strongly, or at least did. Weak tables may have dropped entries that will not be scavenged until a hash-table-clean! therefore a limit. An O(1) operation.

hash-table-equivalence-function

[procedure] (hash-table-equivalence-function HASH-TABLE)

The HASH-TABLE equivalence-function.

hash-table-min-load

[procedure] (hash-table-min-load HASH-TABLE)

The HASH-TABLE minimum load factor.

hash-table-max-load

[procedure] (hash-table-max-load HASH-TABLE)

The HASH-TABLE maximum load factor.

hash-table-weak-keys

[procedure] (hash-table-weak-keys HASH-TABLE)

Does the HASH-TABLE use weak references for keys?

hash-table-weak-values

[procedure] (hash-table-weak-values HASH-TABLE)

Does the HASH-TABLE use weak references for values?

hash-table-mutable?

[procedure] (hash-table-mutable? HASH-TABLE)

Always returns #t.

hash-table-ephemeral-keys

hash-table-ephemeral-values

[procedure] (hash-table-ephemeral-keys HASH-TABLE)
[procedure] (hash-table-ephemeral-values HASH-TABLE)

Always returns #f.

hash-table-has-initial?

[procedure] (hash-table-has-initial? HASH-TABLE)

Does the HASH-TABLE have a default initial value?

hash-table-initial

[procedure] (hash-table-initial HASH-TABLE)

The HASH-TABLE default initial value.

hash-table-key-vector

[procedure] (hash-table-key-vector HASH-TABLE)

Returns a vector of the keys in the HASH-TABLE population.

hash-table-value-vector

[procedure] (hash-table-value-vector HASH-TABLE)

Returns a vector of the values in the HASH-TABLE population.

hash-table-entries

[procedure] (hash-table-entries HASH-TABLE)

Returns the keys and values lists as values.

hash-table-vectors

[procedure] (hash-table-vectors HASH-TABLE)

Returns the keys and values vectors as values.

hash-table->plist

[procedure] (hash-table->plist HASH-TABLE)

Returns the population of the HASH-TABLE as a property-list.

hash-table-clean!

[procedure] (hash-table-clean! HASH-TABLE)

Scavenges any broken weak entries in HASH-TABLE.

Hashing Functions

Usage

(import (srfi 69 hash))

A larger set of hashing functions are available, beyond the four mandated by the SRFI. Please refer to the SRFI 69 egg documentation.

Author

Felix, Kon, The CHICKEN Team.

Repository

This egg is hosted on the CHICKEN Subversion repository:

https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/srfi-125

If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.

Requirements

srfi-69 srfi-128

test test-utils

Version History

0.0.9
Remove minor hash-table-set! overhead.
0.0.8
Fix tested property function names.
0.0.7
The srfi-69 provides hash functions. Remove the trailing ? from property functions. The (srfi 125) types reference the module.
0.0.6
Fix type references. Fix hash-table-update!. Fix hash-table-mutable?, etc. result.
0.0.5
Remove duplicate checks.
0.0.4
Speedup hash-table-pop!.
0.0.3
Proper reexport.
0.0.2
Slimming.
0.0.1
CHICKEN 6 release.

License

Copyright (c) 2008-2021, The Chicken Team
Copyright (c) 2000-2007, Felix L. Winkelmann
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. The name of the authors may not be used to endorse or promote products
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.