hashtable-delete!(3scm)
π hashtable-delete! β bestie's guide to yeeting an association
ok so you're reading the Scheme Programmer's Manual page for hashtable-delete! and honestly? iconic choice. this is the lil procedure that takes an association out of a hashtable. no drama, no leftovers, just gone. β¨
π LIBRARY π
import it like this, both work:
(import (rnrs)) ;R6RS
(import (rnrs hashtables)) ;R6RS
πΈ SYNOPSIS πΈ
(hashtable-delete! hashtable key)
π DESCRIPTION π
hashtable-delete! removes any association for key within hashtable. that's it. that's the whole vibe. the association is uninvited from the party and doesn't get to come back unless you set it again, periodt. π
π¦ RETURN VALUES π¦
returns unspecified values. yeah. it's giving "i did the thing, don't ask me what i returned." don't rely on whatever comes back, bestie, it's not for you. π
π EXAMPLES π
ok so watch this β we set 'foo to 0, then delete 'foo, then delete 'bar (which was never even there, no cap), and the size is...
(let ((ht (make-eq-hashtable)))
(hashtable-set! ht 'foo 0)
(hashtable-delete! ht 'foo)
(hashtable-delete! ht 'bar)
(hashtable-size ht))
=> 0
0 π₯ deleting something that isn't there is not a whole crisis, it just doesn't do anything. she's unbothered.
π COMPATIBILITY π
this procedure is unique to R6RS. literally main character energy, she doesn't exist in the other standards. π
β 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, hashtable should be a mutable hashtable and key should be in the domain of the hashtable's hash and equal functions. π so yeah, if you hand her an immutable hashtable or a key the hash/equal functions can't handle, she WILL raise the&assertionand you will hear about it.
π§ SEE ALSO π§
hashtable-clear!(3scm)β the "delete everything" girliehashtable-set!(3scm)β the "put it back in" girlie
π STANDARDS π
R6RS. that's the standard, that's the rule, that's the whole situation. π«Ά
πΈ HISTORY πΈ
this procedure first appeared in R6RS. an equivalent procedure can be found in SRFI-69 under the name hash-table-delete! β so if you're hanging out over there, she's going by a different name, iykyk. π¦
π 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/. π«Ά
and that's the whole page, bestie!! π this was hashtable-delete!(3scm) from the Scheme Programmer's Manual, dated 2023-01-22. go forth and delete responsibly (or don't β deleting a nonexistent key is literally fine). slay. β¨π
π¦ 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