From: Hugh Sasse Staff Elec Eng Date: 2001-06-22T23:54:49+09:00 Subject: [ruby-talk:16769] Re: uniq and "equivalence" On Fri, 22 Jun 2001, ts wrote: > >>>>> "H" == Hugh Sasse Staff Elec Eng writes: > > H> Array.uniq seems to rely on deleting multiple references to the same object. > H> Furthermore, this test for sameness seems to be based on object.id rather > H> than == or ===. Most of the time this is right and proper, and also > H> efficient. I support my belief that this is going on with: > > Array#uniq make first an hash, then delete the elements. is that Object#hash() or Hash.new()? > > H> When this behaviour of uniq is not not what I want, how do I change it? > > Change the hash function for the objects Object#hash must return a fixnum such that a.eql?(b) means a.hash = b.hash. That is a pretty tall order for arrays of floats. Has anyone any suggestions on how to proceed? > > > Guy Decoux > Hugh hgs@dmu.ac.uk