On Fri, 10 Dec 2004 06:43:09 +0900, Gavin Sinclair
<gsinclair / soyabean.com.au> wrote:
> On Friday, December 10, 2004, 7:24:42 AM, trans. wrote:
>>> Small caveat: remember that Array#delete returns the thing
>>> deleted, not the array, so you can't chain it as you would
>>> #compact.
>> Good catch. Enough reason to have something for it, I think. I
>> may add a general method to my libs:
[...]
>> Better name? Or better solution?
> Array#compact
> 
> It doesn't currently take a parameter, so allow it to take one.
> FWIW I think Array#delete should be deprecated, and Array#compact
> extended in this fashion. I don't see a good rationale for the
> return value of Array#delete, and when a method is called #delete
> there is always confusion about whether it's destructive.

  a = %w(a b c d a b c d a b c d)
  if (a.delete("a"))
    ...
  else
    ...
  end

  if (a.delete("z"))
    ...
  else
    ...
  end

-austin
-- 
Austin Ziegler * halostatue / gmail.com
               * Alternate: austin / halostatue.ca