eq and hashing (was Re: [plt-scheme] How to make unit functors?)

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Thu May 29 11:34:44 EDT 2003

Robby Findler wrote:

>But, if you take the hash-code of one of them and then wait a while
>(and perform some garbage collections) then take the hash-code of the
>other, you'll find that they are different. 
>
I have understood the hash-code will remain the same as long as the symbol
(that specific) is alive.

Experiments in the REPL supports this (but is of course not conclusie).

Try

  (define s 's)           ; so the symbol is kept alive
  (eq-hash-code s)
  (collect-garbage)
  (eq-hash-code s)
  (collect-garbage)
  (eq-hash-code s)
  (collect-garbage)
  (eq-hash-code s)

-- 
Jens Axel Søgaard













Posted on the users mailing list.