James Edward Gray II wrote:
> On Feb 5, 2006, at 5:28 AM, William James wrote:
>
> > This may not be of any use to you, but here's a way to delete all
> > elements but the first:
> >
> > class Array
> >   def no_dup!( x )
> >     (i = index(x)) && delete( x ) && insert(i,x)
> >     self
> >   end
> > end
>
> Array.uniq!
>
> ???
>
> James Edward Gray II

irb(main):008:0> a=[1,1,2,2,3,3]
=> [1, 1, 2, 2, 3, 3]
irb(main):009:0> a.no_dup!(2)
=> [1, 1, 2, 3, 3]
irb(main):010:0> a.uniq!(3)
ArgumentError: wrong number of arguments (1 for 0)
        from (irb):10:in `uniq!'
        from (irb):10
irb(main):011:0> a.uniq!
=> [1, 2, 3]

Array#uniq is "massively destructive".