From: Kevin Compton Date: 2007-05-11T22:32:54+09:00 Subject: Re: how to remove dups from 2 lists? ------=_Part_168822_9064645.1178890373542 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I think a big part of it is that there are variations in what we assume the questioner wanted. In my case, I interpreted it as: 1) remove items that appear in both lists from both lists For instance, removeDups ([a, b, c, d], [b, d, f, g]) => [a, c], [f, g] 2) don't go so far as remove more than the common count of dups For instance, removeDups ([a, a, b, b, c, d, d], [b, d, d, d, f, g, g]) => [a, a, b, c], [d, f, g, g] 3) keep the lists in original order (probably not required but I'm not sure) I guess, it would be nice to have had the *need* demonstrated via example or clearly stated.. but its been fun. On 5/11/07, Lloyd Linklater wrote: > > I am new to Ruby but I am wondering why it is that no one is using the > uniq call that gets rid of duplicates in an array. Couldn't you join > the two arrays, then call MyJoinedArray.uniq!, then take the resulting > set and format it as you please? I know that you are doing more than > just that. I was mostly wondering why you would not use the built in > call. > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_168822_9064645.1178890373542--