On Saturday, August 3, 2019 at 1:36:01 PM UTC+8, Jon Zeppieri wrote:
>
> On Sat, Aug 3, 2019 at 12:52 AM Jesse Wang <hell...@gmail.com 
> <javascript:>> wrote: 
> > 
> > If I want to turn the hash code into array index in a hash table, do I 
> need to 
> > apply another uniform hash function such as md5 on the result of 
> equal-hash-code? 
> > 
>
> That wouldn't accomplish anything. The defining feature of a function 
> is that the output depends solely on the input. Applying the same 
> function to colliding hash codes will get you more colliding hash 
> codes, only at a higher cost. 
>

I think you are right here.
 

>
> If you're going to implement your own hash tables instead of using the 
> ones that Racket provides, you can use whatever hash function you 
> want, but in that case you want to start with the key itself, not with 
> the result of Racket's hash function. Hash functions, by their very 
> nature, tend to discard information. If you start with the result of 
> Racket's hash functions, you're not going to be able to do better than 
> them. 


What I want is a uniform hash function for different types.
Racket's equal-hash-code seems to give non-uniform hash codes for different 
types
of primitive types, so I wonder how Racket achieves good performance in a
hash table with different primitive type keys at the same time...

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/fc2ded74-043e-413c-b1da-6b3a06837f8d%40googlegroups.com.

Reply via email to