From: William Djaja Tjokroaminata Date: 2002-09-26T12:04:12+09:00 Subject: Re: Set Union on Array of Objects Hi, You have a very interesting case. It seems that while array subtraction is implemented internally using "rb_equal()" which invokes the "==" method, array union (and some others) is implemented using some hashing of the actual objects themselves. I don't know a way to get what you expect except to implement explicitly the method yourself in Ruby. (Probably this is another candidate for "Things That Newcomers to Ruby Should Know"? :) ) Regards, Bill ============================================================================ Michael Halcrow wrote: > Why do array subtraction and array union not behave in the same manner > when operating on an array of user-defined objects? Specifically, how > can I get the Array union operator to use the user-defined "==" method > of the objects, as the Array subtraction operator does? What is the best > way to get what I expect? > Thanks, > Mike