------ art_46047_28019076.1164252418681 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 11/23/06, Darshan.Ishaya <Darshan.Ishaya / gmail.com> wrote: > > Well, I'm new to Ruby, but it was an interesting question so I gave it > a stab. My first idea was > > a.sort b.sort > > which works if all the elements of an array of of the same class. But > if you mix objects of different class (like you example with Fixnums > and a String), sort() craps out on it. You can pass a block to sort, > but I couldn't think of a good way to use that to our advantage. So I > resorted to more of a brute force method: > > def same_elems?(array1, array2) > return false unless array1.length array2.length > > tmp rray2.clone > array1.each do |item| > if i mp.index(item) then tmp.delete_at(i) end > end > return tmp.empty? > end > > As far as I can tell it meets all of your criteria. > > Darshan > Hi Darshan, Thanx for you response. I looks like it should do the trick. Thanx ------ art_46047_28019076.1164252418681--