"ES" <ruby-ml / magical-cat.org> schrieb im Newsbeitrag
news:423A6A2C.8090803 / magical-cat.org...
> Derek Wyatt wrote:
> > | I respectfully disagree. I was SURE from the name that it must be
some
> > | function to modify the original array, inserting new entries. It
took
> > | me a long time to understand what it was for.
> > |
> > | Obviously we can't ditch the old name (for backwards-compatibility
> > | reasons) but a better alias that is promoted to new users would be a
> > | good idea, IMHO.
> > |
> > | How about #each_with_state for a name? #accumulate (or #accum) is
not a
> > | bad name, but also implies to me that the result will be the
> > | sum/product/concatenation of values. How would #accum fit for the ri
> > | example of using #inject to find the longest item in a list, for
> > | example? Some form of accumulation is one of the more common uses of
> > | #inject (I gather) but by no means the only use.
> >
> > Is not #reduce the name we're looking for?  Or is it not faithful
enough
> > to lisp to rip off the name?
>
> I'm convinced there were two main creators for Lisp. One designed the
> language, and the other one (who, incidentally, was an insane monkey),
> came up with the function names.
>
> There's really no perfect name for this method...I'm partial to #fold
> after Haskell & Co. but #accum (without the -ate) may describe it's
> function the best. Then again, this is just wishful thinking.

#aggregate might be a good choice, too - reminds me of SQL aggregation
functions like SUM, AVG, MAX etc.

Kind regards

    robert