You need to also define a hash method for this type.

> On Jul 16, 2015, at 9:16 AM, Marc Gallant <marc.j.gall...@gmail.com> wrote:
> 
> The unique function doesn't appear to work using iterables of custom 
> composite types, e.g.,
> 
> julia> type Foo
>        x::Int
>        end
> 
> julia> import Base: ==
> 
> julia> ==(f1::Foo, f2::Foo) = f1.x == f2.x
> == (generic function with 85 methods)
> 
> julia> unique(foos)
> 2-element Array{Foo,1}:
>  Foo(4)
>  Foo(4)
> 
> julia> unique(foos)[1] == unique(foos)[2]
> true
> 
> Is this the intended behaviour?

Reply via email to