JuliaPhysics / PeriodicTable.jl

Periodic Table for Julians! :fire:
Other
111 stars 26 forks source link

Implement isequal(...) and hash(....) #27

Closed NicholasWMRitchie closed 4 years ago

NicholasWMRitchie commented 4 years ago

It would be very helpful to implement isequal and hash in a fast efficient manner since in many uses Element instances are used as keys.

For example: Base.hash(elm::Element) = hash(elm.number) Base.isequal(elm1::Element,elm2::Element) = elm1.number==elm2.number

and maybe also

Base.isless(elm1::Element, elm2::Element) = elm1.number < elm2.number

stevengj commented 4 years ago

A PR would be welcome.

berquist commented 4 years ago

Can someone close this, since it was done in https://github.com/JuliaPhysics/PeriodicTable.jl/pull/28?