[ruby-talk:02330] Function of Array.filter surprises me

From: mrilu <mrilu@...>
Date: 2000-04-01 12:57:46 UTC
List: ruby-talk #2330
I don't expect Array.filter to do task of Array.replace_with!.
I would expect it to be alias for Enumerable.select (or it's alias 
find_all), that is filter or select all the elements satisfying
given condition.

Moreover it is change-in-place function so wonder where lurks missing
exclamation mark? As you see, Enumerable.select don't need any
exclamation, so illusory connection between these two is even greater.

I could add that Enumerable.apply would be better name for collect, IMO.
And that Enumerable (among other things) is very nice, indeed.

I wonder how long it takes before I start to hit features which
mostly annoy :).

In This Thread

Prev Next