hashtable-clear!(3scm)
β¨ NAME β¨
Okay so hashtable-clear! from the Scheme Programmer's Manual β page tag hashtable-clear!(3scm) β is here to remove all entries from a hashtables β¨ (yes, the original says βa hashtables,β and we are keeping that exact line, periodt π
).
π LIBRARY π
These are the imports, bestie β both tagged ;R6RS:
(import (rnrs)) ;R6RS
(import (rnrs hashtables)) ;R6RS
πͺ SYNOPSIS πͺ
(hashtable-clear! hashtable)
(hashtable-clear! hashtable k)
π DESCRIPTION π
It removes all associations from hashtable. Like, every single one. Gone. Slay. π
If you give it a second argument, the current capacity of the hashtable is reset to approximately k elements. That's the whole tea, fr fr.
π RETURN VALUES π
This procedure returns unspecified values. No promised useful return value, bestie β it's giving side-effect main character energy. β¨
πΈ EXAMPLES πΈ
Vibe check: make an eq hashtable, set foo to bar, clear the whole thing, then check the size β and boom, it's 0:
(let ((ht (make-eq-hashtable)))
(hashtable-set! ht 'foo 'bar)
(hashtable-clear! ht)
(hashtable-size ht))
=> 0
π¨ 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. In particular,hashtableshould be a mutable hashtable andkshould be an exact non-negative integer.
π SEE ALSO π
Go check out hashtable-delete!(3scm) β it's right there in the same orbit, bestie. π
π STANDARDS π
R6RS β that's the standard, periodt.
π°οΈ HISTORY π°οΈ
This procedure first appeared in R6RS. Iconic since day one. π
π AUTHORS π
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.
Cute sign-off: this page is from the Scheme Programmer's Manual, dated 2023-01-21, page tag hashtable-clear!(3scm) β bye bestie, go clear some tables ππ«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2023 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms