symbol-hash(3scm)
π symbol-hash π
okay bestie, welcome to the Scheme Programmer's Manual page for symbol-hash β it's giving tiny but iconic. π«Ά
β¨ NAME β¨
symbol-hash β symbol hash function. no cap.
πΈ LIBRARY πΈ
These imports are literally right here:
(import (rnrs)) ;R6RS
(import (rnrs hashtables)) ;R6RS
π¦ SYNOPSIS π¦
(symbol-hash symbol)
π DESCRIPTION π
So symbol-hash returns an integer hash value for symbol. That's the whole vibe. π
π₯ IMPLEMENTATION NOTES π₯
Symbol names are immutable and therefore the hash value can be computed once and stored in the object. It is possible to delay the computation until the hash is needed, similarly to how Chez Scheme lazily generates the names of gensyms. π§
β RETURN VALUES β
Returns a single value; an (exact) integer. literally one value, bestie. β¨
π EXAMPLES π
here's the lil demo, copy-paste ready:
(let ((ht (make-hashtable symbol-hash eq?)))
(hashtable-set! ht 'car 'vehicle)
(hashtable-set! ht 'blue 'color)
(hashtable-ref ht 'car #f))
=> vehicle
π§ APPLICATION USAGE π§
This procedure is used with make-hashtable(3scm) together with eq?(3scm). π«Ά
π COMPATIBILITY π
This procedure is unique to R6RS. Similar procedures exist in SRFI-126 and SRFI-128. πΈ
π 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.
π SEE ALSO π
equal-hash(3scm), make-hashtable(3scm)
π STANDARDS π
R6RS.
π HISTORY π
This procedure first appeared in R6RS. A similar procedure existed in the sample implementation of SRFI-69 but the official interface of that SRFI does not export it. Instead the generic hash procedure would be used for symbols.
π«Ά 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/.
xoxo π β page symbol-hash(3scm), dated 2023-03-20. bye bestie! π¦
π¦ 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