type Composite
a::Int
b::Int
end
function isequal(a::Composite, B::Composite)
return a.a==b.a && a.b==b.b
end
function hash(a::Composite)
return a.a+a.b
end
a = Composite(1,1)
b = Composite(1,1)
println(isequal(a,b))
println(hash(a)==hash(b))
d = { a => 1}
println(haskey(d,b))
The output is
true
true
false
Am I missing something here? Is it possible to use composite types for a
key?
