hashtable-keys(3scm) Scheme Programmer's Manual hashtable-keys(3scm)

hashtable-keys - get the keys from a hashtable

(import (rnrs))                     ;R6RS
(import (rnrs hashtables))          ;R6RS

(hashtable-keys hashtable)

Returns a vector of all keys in hashtable. The order of the vector is unspecified.

Returns a single value; a vector.

(do ((ht (make-eqv-hashtable))
     (n 10)
     (i 0 (+ i 1)))
    ((> i n)
     (vector-sort < (hashtable-keys ht)))
  (do ((j 0 (+ j 1)))
      ((> j n))
    (hashtable-set! ht (* i j) #t)))
    => #(0 1 2 3 4 5 6 7 8 9 10 12 14 15 16 18 20
        21 24 25 27 28 30 32 35 36 40 42 45 48 49 50
        54 56 60 63 64 70 72 80 81 90 100)

This procedure is unique to R6RS. Similar procedures exist in SRFI-69 and SRFI-125.

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. In particular, hashtable should be a hashtable.

hashtable-entries(3scm)

R6RS

This procedure first appeared in R6RS. An equivalent procedure already existed in SRFI-69 under the name hash-table-keys.

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