string-hash(3scm) Scheme Programmer's Manual string-hash(3scm)

string-hash, string-ci-hash - string hash functions

(import (rnrs))                     ;R6RS
(import (rnrs hashtables))          ;R6RS

(string-hash string)
(string-ci-hash string)

Returns an integer hash value for string, based on its current contents. It is used with make-hashtable(3scm).
string-hash
This hash function is suitable for use with string=?(3scm) as an equivalence function.
string-ci-hash
This hash function ignores case. It is suitable for use with string-ci=?(3scm) as an equivalence function.

Returns a single value; an integer.

(= (string-hash "Quux") (string-hash "Quux"))     =>  #t
(= (string-ci-hash "quux") (string-hash "QUUX"))  =>  #t or #f
(= (string-hash "foo") (string-hash "bar"))       =>  #t or #f

This procedure is used as an argument to make-hashtable(3scm).

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.

make-hashtable(3scm)

R6RS, SRFI-69

The first Scheme report to include this procedure was R6RS for its new hashtable library. There is a similar procedure in SRFI-69.

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.

2022-05-12