Ikarus's string-hash is not suitable as a hash function, because hash functions are required to return non-negative exact integers, and Ikarus's string-hash can return negative numbers.
I realize that you've made string-hash return numbers in the whole fixnum range on purpose, but please consider this repl session:
&message: "invalid return value from hash function"
&irritants: (-171070200)
If I want to use string-hash in my own hash functions, then I need to e.g. wrap it in (abs ...) if I want the code to run in Ikarus. If string-hash can return negative numbers, shouldn't the hashtables also accept hash functions that return negative numbers? But then you run the risk that people write code that will only run on Ikarus, so shouldn't string-hash return non-negative numbers after all?
Besides, returning non-negative fixnums only halves the number of possible hashes. Does it really make much difference?
Ikarus's string-hash is not suitable as a hash function, because hash functions are required to return non-negative exact integers, and Ikarus's string-hash can return negative numbers.
I realize that you've made string-hash return numbers in the whole fixnum range on purpose, but please consider this repl session:
If I want to use string-hash in my own hash functions, then I need to e.g. wrap it in (abs ...) if I want the code to run in Ikarus. If string-hash can return negative numbers, shouldn't the hashtables also accept hash functions that return negative numbers? But then you run the risk that people write code that will only run on Ikarus, so shouldn't string-hash return non-negative numbers after all?
Besides, returning non-negative fixnums only halves the number of possible hashes. Does it really make much difference?
Launchpad Details: #LP413809 Göran Weinholt - 2009-08-14 17:28:31 -0400