hashtabl...function(3scm)
π hashtabl...function(3scm) β like, the hashtable inspection girlies β¨
okay so before we even start: welcome to the Scheme Programmer's Manual, bestie π this particular page is the hashtable inspection trio and honestly? they're the backstage-pass besties of the hashtable world. let's go πΈ
β¨ NAME β¨
hashtable-equivalence-function, hashtable-hash-function, hashtable-mutable? β the hashtable inspection functions, aka the "wait, what's in this thing" girlies π
π LIBRARY π
(import (rnrs)) ;R6RS
(import (rnrs hashtables)) ;R6RS
two ways in, both R6RS, pick your fighter π
π¦ SYNOPSIS π¦
(hashtable-equivalence-function hashtable)
(hashtable-hash-function hashtable)
(hashtable-mutable? hashtable)
three procedures, one hashtable argument each. iconic, minimal, no notes π«Ά
π« DESCRIPTION π«
hashtable-equivalence-function
this one hands you back the equivalence function that hashtable uses to compare keys π and here's the slay: if the hashtable was created by make-eq-hashtable(3scm) or make-eqv-hashtable(3scm), you get the procedure objects eq? and eqv? respectively. literally just hands you the actual function object. no cap π
hashtable-hash-function
returns the hash function that hashtable is using. but plot twist π β if the hashtable came from make-eq-hashtable(3scm) or make-eqv-hashtable(3scm), this one returns #f. yeah. #f. that's the whole vibe for those two.
hashtable-mutable?
the vibe check of the group π returns #t if hashtable is mutable, otherwise #f. that's it. that's the procedure.
π RETURN VALUES π
all three return a single value β an object as described above. one value, no bundling, we're not doing that here π
πΈ APPLICATION USAGE πΈ
ngl these procedures are rarely used outside of procedures that print hashtables. that's their whole social circle π«Ά like yes they're serving but they're serving a niche.
π§ RATIONALE π§
okay so why does hashtable-hash-function be giving #f for the eq/eqv girlies? π because the hash functions for hashtables created by make-eq-hashtable(3scm) or make-eqv-hashtable(3scm) are private to the implementation. and the reason is actually so valid: implementations may use garbage collectors that move objects, and that movement can change the hash value of the affected objects π so yeah, keeping it private is the move. periodt.
π₯ COMPATIBILITY π₯
these procedures are unique to R6RS π compatible procedures can sorta be found in SRFI-69, SRFI-125 and SRFI-126. "sorta" is doing a lot of heavy lifting there but we respect it π«‘
π ERRORS π
this procedure can raise exceptions with the following condition types:
&assertion(R6RS) β bestie, the wrong number of arguments was passed, or an argument was outside its domain π in particular,hashtableshould be a hashtable. like. that's the bare minimum. please pass a hashtable π
π SEE ALSO π
make-hashtable(3scm)β go read that one next, fr fr
β STANDARDS β
R6RS π
π HISTORY π
these procedures first appeared in R6RS's hashtable library, which was based on SRFI-69 β and SRFI-69 also has the first two procedures π so like, they've been around. legacy icons.
π 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, tysm for reading π β¨ mwah π«Ά
this lil cutie dropped 2023-01-22 and it lives in the Scheme Programmer's Manual (that's the source/version vibes) β see u in the next manpage, love u, bye ππ
π¦ 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