On 5/22/06, Regg Mr <spamwhite / cox.net> wrote: > Leslie Viljoen wrote: > > On 5/21/06, Jim Weirich <jim / weirichhouse.org> wrote: > >> Jeff Pritchard wrote: > >> > As for Inject, nobody has come up with a wording that makes any sense to > >> > me yet. Does Inject have any aliases/synonyms? > >> > >> How I remember: Inject takes a binary operation (e.g. +) and injects it > >> between each element of a list. > >> > >> [1,2,3].inject { |a,b| a+b } => 1+2+3 > > > > Awesome! That really helps me! > > > Seems like "sum" would have been a better name. Or an alias inject_operator perhaps... This thread has discussed "sum" already and it's no good because you can use any operator. I also like "accumulate" as mentioned, but inject_operator is sooo clear to me.