| hashtable-entries(3scm) | Scheme Programmer's Manual | hashtable-entries(3scm) |
NAME
hashtable-entries - get the entries in the hashtable as two vectors
LIBRARY
(import (rnrs)) ;R6RS (import (rnrs hashtables)) ;R6RS
SYNOPSIS
(hashtable-entries hashtable)
DESCRIPTION
Returns a vector of the keys in hashtable and a vector of the corresponding values.
RETURN VALUES
Returns two values; two vectors of equal length.
EXAMPLES
(let ((h (make-eqv-hashtable)))
(hashtable-set! h 1 'one)
(hashtable-set! h 2 'two)
(hashtable-set! h 3 'three)
(hashtable-entries h))
=> #(1 2 3)
#(one two three)
; entries may be in different order
APPLICATION USAGE
This procedure is used when iterating over the entries of a hashtable in an indeterminate order or when you need all the associated values from a hashtable.
RATIONALE
If a program needs all entries in a hashtable then this procedure is significantly faster than using hashtable-keys(3scm) together with hashtable-ref(3scm) for each key, because it does not need to use the hash and equal functions.
COMPATIBILITY
This procedure is unique to R6RS. An equivalent procedure can be found in SRFI-125 under the name hash-table-entries.
ERRORS
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
- The wrong number of arguments was passed or an argument was outside its domain.
SEE ALSO
hashtable-keys(3scm)
STANDARDS
R6RS
HISTORY
This procedure first appeared in R6RS.
AUTHORS
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.
| 2023-01-22 |