On Dec 4, 12:31=A0pm, "Robert Dober" <robert.do... / gmail.com> wrote:
> On Thu, Dec 4, 2008 at 6:07 PM, Trans <transf... / gmail.com> wrote:
> > =A0[1,2,3].compact(1) =A0#=3D> [2,3]
>
> > Which is similar to #delete, except not in place.
>
> Indeed this is the behavior I had expected from delete and having a
> delete! for what delete does now.> Though, using #=3D=3D=3D
> > instead of #=3D=3D could be a very useful differentiation.
> Hmm a negative grep
>
> > =A0[1,2,3,:x,:y,:z].compact(Symbol) #=3D> [1,2,3]
>
> Now I really would rather think of #reject although I had a different
> idea for it which would answer your next question.

Almost. There's an important distinction. #reject is an Enumerable
method. #compact is an Array method. B/c of this, #compact can be and
is implemented much more efficiently. Plus, it's not suitable for
Enumerable methods to take arguments (though I heard a rumor this
would change for 1.9, but I don't know if it did).

T.