lambda-dev Digest, Vol 15, Issue 20 [reduce method result type]
lk at teamten.com
Tue Mar 8 00:37:35 PST 2011
On Mon, Mar 7, 2011 at 6:30 PM, Neal Gafter <neal at gafter.com> wrote:
> It would be a shame to ignore [the functional programming community's] experience
> and repeat mistakes of the distant past.
Their mistake of the distant past was to use fold-left in the first place.
> for some simple examples, <Matt Malone's blog post "Lots And Lots Of
> foldLeft Examples"<http://oldfashionedsoftware.com/2009/07/30/lots-and-lots-of-foldleft-examples/>
I assert that every single one of those examples would be more clearly
(if more verbosely) expressed as a for-loop. (I tried this myself and
it's striking how much clearer the for-loop is, and often more
efficient.) I can genuinely see why computer science theorists love
fold-left, but it doesn't belong in any code that will later be read
by a human. Java should follow the example of Python 3000 and remove
fold-left from the API.
> Being composed of experts, I expect that the Project Lambda JSR expert group
> has members who are well versed in these techniques.
I'm hoping for exactly the same thing.
More information about the lambda-dev