[julia-users] Re: customized hash function (or equality function)?
Base.hash(p::Poly1, h::Uint) = hash(p.coef, h) Base.(==)(p1::Poly1, p2::Poly2) = p1.coef == p2.coef (If you override hash you should always override == to be consistent, and vice versa.)
[julia-users] Re: customized hash function (or equality function)?
wonderful! thanks!! On Wednesday, December 10, 2014 8:24:17 PM UTC-5, Steven G. Johnson wrote: > > Base.hash(p::Poly1, h::Uint) = hash(p.coef, h) > Base.(==)(p1::Poly1, p2::Poly2) = p1.coef == p2.coef > > (If you override hash you should always override == to be consistent, and > vice versa.) >