From: Enrique Comba Riepenhausen Date: 2007-05-11T16:55:14+09:00 Subject: Re: how to remove dups from 2 lists? On 11 May 2007, at 09:10, Robert Klemme wrote: > > Sets also come in handy - especially if those lists are large. > > Kind regards > > robert I would actually need to know what you really want to do :( Let me explain. In a list you can put different elements in the list with the same values. Unlike in a hash, where the keys must be unique. Do you want to remove the elements that are in the same position on the lists and are equal? If so I would say: require 'generator' list1 = [1,1,2,3,4,6] # => I included the 6 to show what I mean... list2 = [2,2,3,5,5,6] # => I included the 6 to show what I mean... def RemoveDupsFromLists ( list1 , list2 ) lists = SyncEnumerator.new(list1, list2) lists.each { |element_list1, element_list2| if list1[element_list1] == list2[element_list2] list1.delete(element_list1) list2.delete(element_list2) end } end Cheers, Enrique Comba Riepenhausen