symbol-hash(3scm)

πŸ“¦ version 0-unstable-2024-02, in nixpkgs unstable

πŸ’… 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