hashtable-set!(3scm) Scheme Programmer's Manual hashtable-set!(3scm)

hashtable-set! - change an association in a hashtable

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

(hashtable-set! hashtable key obj)

Changes hashtable to associate key with obj, adding a new association or replacing any existing association for key.

This procedure can trigger growth of the hashtable, which can require all keys to be hashed again.

Returns unspecified values.

(define ht (make-eq-hashtable))
(hashtable-set! ht 'foo 'bar)
(hashtable-ref ht 'foo #f)   =>  bar

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 and key should be in the domain of the hashtable's hash and equal functions.

make-hashtable(3scm), hashtable-ref(3scm)

R6RS

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

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