Michael Erdmann wrote:
Dear all the code fragement below works as expected:
(define h (make-hash-table))
(define A_Age 'Age)
(define Michael "Michael")
(put! h Michael A_Age 45)
(write (get h Michael A_Age )) (newline)
(write (hash-table-ref h Michael)) (newline)
(write (hash-table->list h)) (newline)
address@hidden:~/scheme/x> ./ht
45
((Age . 45))
(("Michael" (Age . 45)))
_but_ when i am replacing Michael by "Michael" every where
where i invoke get it fails. Probly because they are not
the same objects.
Why is it like this implemented? It is not very helpfull
in this implementation, or did i miss something?
It depends on the comparison function used by the hash-table.
The default is eqv?, but you can pass the desired function
to make-hash-table:
(define h (make-hash-table string=?))
eqv? is more efficient, so it is the default.
cheers,
felix