Dictionary with custom hash function

Just wrap your keys in a new type:

struct MyKey
    val::UInt
end
Base.hash(a::MyKey, h::UInt) = xor(a.val, h)
Base.(==)(a::MyKey, b::MyKey) = a.val == b.val
11 Likes