[julia-users] Re: Hashing question

2014-11-18 Thread Ivar Nesje
Good point! Thanks for the doc update. That was way overdue. I had some trouble understanding the following sentence: For values that are not floating-point, ``isequal`` calls ``==`` (so that > if you define a ``==`` method for a new type you automatically get > ``isequal``). I would rather

[julia-users] Re: Hashing question

2014-11-18 Thread Steven G. Johnson
On Friday, November 14, 2014 3:42:36 PM UTC-5, Simon Danisch wrote: > > So one must implement both hash(object, hash), and isequal(a,b) for a set > to work... > Makes sense! > Thanks a lot :) > Except that you should normally extend ==, not isequal, in order to get both methods. See https://g

[julia-users] Re: Hashing question

2014-11-18 Thread Simon Danisch
Ahhh, I finally understand a little bit more about dicts and types. I'm nearly always using immutable types, which when isbits(type) is true, gets optimized in a way, that if they have the same value, they get stored as the same object with the same object_id. This is why I believed for a long ti

[julia-users] Re: Hashing question

2014-11-14 Thread Simon Danisch
So one must implement both hash(object, hash), and isequal(a,b) for a set to work... Makes sense! Thanks a lot :) Am Freitag, 14. November 2014 20:55:36 UTC+1 schrieb Simon Danisch: > > Hi, > I hardly have any experience with hashing, so I thought I better ask here, > before I do something silly

[julia-users] Re: Hashing question

2014-11-14 Thread Ivar Nesje
I'd suggest you start with the documentation for hash and isequal , and look at some implementation of hash to understand the two argument version. As far as I understand,