Hi --
On Mon, 31 Mar 2008, Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: inject's pathological case..."
> on Mon, 31 Mar 2008 00:27:58 +0900, "David A. Black" <dblack@rubypal.com> writes:
>
> |> AFAIK, Matz correct me if I'm wrong, Ruby got the name inject from
> |> Smalltalk, along with collect, select, detect and several other
> |> methods. The other three I mention have alias, map for collect,
> |> find_all for select, and find for detect, but inject is still just
> |> inject in Ruby.
> |
> |It picks up the synonym "reduce" in 1.9 -- which I think is kind of
> |too bad, since inject in Ruby has such a distinctive personality and
> |cult following :-)
>
> reduce, fold, foldl; these are some of the candidates. But I think I
> have to wait for consensus for a while.
I would like to suggest the null alias :-) I think calling it #inject
is fine. It's well-documented that the same function has other names
in other languages; I don't think Ruby needs more than one, and it
just adds the need to explain and account for the synonym.
David
--
Rails training from David A. Black and Ruby Power and Light:
ADVANCING WITH RAILS April 14-17 New York City
INTRO TO RAILS June 9-12 Berlin
ADVANCING WITH RAILS June 16-19 Berlin
See
http://www.rubypal.com for details and updates!