On 6/20/06, James Edward Gray II <james / grayproductions.net> wrote: > Would someone please explain this behavior to me? > > 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}] > > # inefficient work-around > p a.inject([]) { |cp, e| cp.include?(e) ? cp : cp << e } #=> > [{:foo=>:bar}] > > James Edward Gray II > Doesn't seem to work for hashes at all: irb(main):005:0> [{}, {}].uniq => [{}, {}] Yet: irb(main):008:0> {} == {} => true