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

hashtable-clear! - remove all entries from a hashtables

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

(hashtable-clear! hashtable)
(hashtable-clear! hashtable k)

Removes all associations from hashtable.

If a second argument is given, the current capacity of the hashtable is reset to approximately k elements.

This procedure returns unspecified values.

(let ((ht (make-eq-hashtable)))
  (hashtable-set! ht 'foo 'bar)
  (hashtable-clear! ht)
  (hashtable-size ht))
    => 0

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 mutable hashtable and k should be an exact non-negative integer.

hashtable-delete!(3scm)

R6RS

This procedure first appeared in R6RS.

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-21