hashtable-contains?(3scm)
๐ hashtable-contains? โ Scheme Programmer's Manual (3scm)
okay so bestie, welcome to the Scheme Programmer's Manual page for hashtable-contains?. this one's short and sweet and honestly kind of a queen. let's get into it ๐
โจ NAME
hashtable-contains? โ check if a key exists in a hashtable
like, does this table know your guy or not. that's the whole vibe check ๐
๐ LIBRARY
(import (rnrs)) ;R6RS
(import (rnrs hashtables)) ;R6RS
both of these get you the goods, no cap ๐
๐ฆ SYNOPSIS
(hashtable-contains? hashtable key)
๐ธ DESCRIPTION
Returns #t if hashtable contains an association for key, #f otherwise.
that's it. that's the whole thing. yes-or-no, in-or-out, slay-or-nay ๐
โญ RETURN VALUES
Returns a single value; a boolean object. just one (1) little boolean, no extra baggage, we love a minimal icon โจ
๐ EXAMPLES
(let ((ht (make-eqv-hashtable)))
(hashtable-set! ht (* 7 6) 'answer)
(hashtable-contains? ht 42))
=> #t
the way (* 7 6) is literally 42... math ate that ๐งฎ๐ฅ
๐ APPLICATION USAGE
This procedure provides a general for checking if hashtables contain certain keys. If the hashtable never has associations with booleans then another common solution is to use hashtable-ref(3scm) with #f as the default value.
ok so like โ this is your general-purpose "is it in there?" tool ๐ซถ. but heads up, bestie: if your hashtable never stores actual booleans, another popular move is calling hashtable-ref(3scm) with #f as the default, and reading the answer off that. just know the difference, iykyk ๐
๐ COMPATIBILITY
This procedure is unique to R6RS.
genuinely one of a kind. main character energy, no other standard can claim her ๐ฅ
๐ 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.- R7RS โ The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.
๐ญ "fail catastrophically" is right there in the spec and we are NOT calm about it. do not pass weird args, bestie. i'm begging ๐
&assertion (R6RS)
๐ง SEE ALSO
hashtable-ref(3scm)
๐ STANDARDS
R6RS
๐ HISTORY
This procedure first appeared in R6RS. An equivalent procedure can be found in SRFI-69 under the name hash-table-exists?.
so she debuted in R6RS, and if you're hanging out in SRFI-69 land you'll find her twin going by hash-table-exists?. same energy, different name, iconic either way ๐
๐ซถ 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 one's from the Scheme Programmer's Manual, dated 2023-01-121, filed under hashtable-contains?(3scm) โ now go check your keys and 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