1 | | As [[http://paste.call-cc.org/paste?id=982e393227789ab1a6c471ada66e729eb28f83b8|pointed out by John Croisant]]: |
| 1 | If you mutate a pair, it's still `eq?` to itself, but the `hash-by-identity` / `eq?-hash` doesn't calculate the same hash anymore, which means the hash table cannot find the key, unless the randomization factor happens to be such that it finds the same bucket, of course, but that's highly unlikely for simple cases like the one below: |
| 2 | |
| 3 | {{{ |
| 4 | #;1> (use srfi-69) |
| 5 | ; loading /home/sjamaan/chickens/4.11.0/lib/chicken/8/srfi-69.import.so ... |
| 6 | ; loading library srfi-69 ... |
| 7 | #;2> (define x (cons 1 2)) |
| 8 | #;3> (hash-by-identity x) |
| 9 | 380849329 |
| 10 | #;4> (set-car! x 3) |
| 11 | #;5> (hash-by-identity x) |
| 12 | 380718257 |
| 13 | #;6> (= #3 #5) |
| 14 | #f |
| 15 | #;7> |
| 16 | }}} |
| 17 | |
| 18 | Originally [[http://paste.call-cc.org/paste?id=982e393227789ab1a6c471ada66e729eb28f83b8|pointed out by John Croisant]]: |