Re: [julia-users] Dictionary lookup using only the hash value

2016-01-13 Thread Mauro
No, this is not possible. Dicts use the function Base.hashindex to convert a hash into an index into the internal storage arrays (one for keys, one for values, one a bool stating whether used or not, see [1]). However, collisions are likely. For instance, 1 and 18 map to the same index for a le

[julia-users] Dictionary lookup using only the hash value

2016-01-13 Thread Ritchie Lee
As I understand it, Julia dicts use Base.hash when storing custom types as keys. Is there a way to look up based on the hash alone? e.g., type MyType a::Int end Base.hash(x::MyType) = hash(x.a, hash(MyType)) x = MyType(1) D = Dict{MyType, Bool}() D[x] = true Now, is there a way to lookup usi