Re: [julia-users] Re: Definition of equality

2015-08-21 Thread Stefan Karpinski
These days you generally want to overload == rather than isequal. On Fri, Aug 21, 2015 at 9:24 AM, Sisyphuss zhengwend...@gmail.com wrote: They are two different operators. import Base.== type inty insideint :: Int end ==(a :: inty, b :: Int) = a.insideint == b inty(5) == 5 On

[julia-users] Re: Definition of equality

2015-08-21 Thread Sisyphuss
They are two different operators. import Base.== type inty insideint :: Int end ==(a :: inty, b :: Int) = a.insideint == b inty(5) == 5 On Friday, August 21, 2015 at 3:10:01 PM UTC+2, Dawid Crivelli wrote: How do you define the `==` operator for a new type? If I try and define the

Re: [julia-users] Re: Definition of equality

2015-08-21 Thread Erik Schnetter
You want to overload `==`, which automatically defines `isequal`. You may also want to overlad `isless`, which then automatically defines ``, ``, `=`, `=`. -erik On Fri, Aug 21, 2015 at 9:43 AM, Stefan Karpinski ste...@karpinski.org wrote: These days you generally want to overload == rather