From: Ari Brown Date: 2007-08-22T01:04:27+09:00 Subject: Re: Detecting duplicates in an array, anything in the standa On Aug 21, 2007, at 4:59 AM, Pe�a, Botp wrote: > From: Robert Klemme [mailto:shortcutter@googlemail.com] > # irb(main):002:0> a.uniq.select{|e| (a-[e]).size < a.size - 1} > > compare also, > > irb(main):056:0> b=a.dup > => [1, 1, 2, 2, 2, 4, 3] > irb(main):057:0> b.uniq.select{|e| (b.reject!{|f| f == e}).size > 1} > => [1, 2] I still think it's easier just to union itself... a = [1,2,3,2,1] b = a & a b = [1,2,3] ---------------------------------------------------------------| ~Ari "I don't suffer from insanity. I enjoy every minute of it" --1337est man alive