From: Levin Alexander Date: 2006-02-05T06:05:36+09:00 Subject: Re: Quiz #65, Principle of Great Surprise, and Array.delete sledgehammer On 2/4/06, Dave Howell wrote:> I mean, this seems so, er, obvious! "Please find one instance of this> object in the array, and return to me the array without that object. If> the array doesn't have that object, then just give the array back to> me." class Array def without_one(elem) new = self.dup # make a copy so that the original is not changed new.delete_at(new.index(elem)) new end end [1,2,3,4,4,4,5,5].without_one(4) #=> [1,2,3,4,4,5,5] -Levin