>>>>> "Brian" == Brian F Feldman <green / FreeBSD.org> writes:
Brian> I know you can define sum in terms of inject, but what is
Brian> the point of having inject if people are just going to use
Brian> it to create sum?
I've used inject (or "reduce") in the following to build a list from
scratch ...
mods.reduce([]) { |mod,list| local_methods(mod) | list }.sort
I use it as often for general things as I do for summing.
--
-- Jim Weirich jweirich / one.net http://w3.one.net/~jweirich
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)