Did you import isequal and hash? Otherwise you're defining your own
functions by that name.


On Mon, Mar 31, 2014 at 6:03 PM, Heorhi Valakhanovich <[email protected]>wrote:

> 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?
>

Reply via email to