The answer was already posted so I just point a minor issue....


In message <slrn9sm655.jub.miles / puzl.pixar.com>
miles / puzl.pixar.com writes:

> a = [1, 2, 3, 4]
> b = a.filter { |i| i % 2 = 0 }
> 
> leaving a = [1, 2, 3, 4] and b = [2, 4].

Array#filter does not behave such way.

  a = [1, 2, 3, 4]
  a.filter { |i| i%2 == 0 }
  #=> -:2: warning: Array#filter is deprecated; use Array#collect!
  p a    #=> [false, true, false, true]

as a warning message says, it is a destrcutive variant of
Array#collect.


-- 
kjana / dm4lab.to                               October 16, 2001
Whatever is worth doing at all is worth doing well.