From: James Edward Gray II Date: 2006-06-20T23:31:30+09:00 Subject: Re: uniq() Oddity On Jun 20, 2006, at 9:25 AM, Matthew Smillie wrote: > On Jun 20, 2006, at 15:17, James Edward Gray II wrote: > >> a = [ { :foo => :bar }, { :foo => :bar } ] >> >> p a #=> [{:foo=>:bar}, {:foo=>:bar}] >> p a[0] == a[1] #=> true >> # why does this next call do nothing? >> p a.uniq #=> [{:foo=>:bar}, {:foo=>:bar}] > > Seems to compare on object id, rather than with ==. Can't be that: >> str1 = "a" => "a" >> str2 = "a" => "a" >> str1.object_id == str2.object_id => false >> [str1, str2].uniq => ["a"] James Edward Gray II