groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russel Winder <>
Subject Re: Adding map, reduce, filter as aliases for collect, inject, grep methods
Date Mon, 02 Nov 2015 09:40:12 GMT
On Mon, 2015-11-02 at 08:29 +0100, Jochen Theodorou wrote:
> Frankly we should discuss this in that light yes. Before Java did not
> have these kinds of methods. Now it has... on streams at least. Which
> means they will be used like that in Groovy as well. Which means they
> will appear side-by-side in programs, if we add an alias or not.

Agreed. Until Java 8 I made the case for map/filter/reduce in Groovy,
but never felt really upset by the collect/findAll/inject because of
the Java symbiosis and the names didn't matter. Java symbiosis now
indicated collect/findAll/inject is the wrong naming, and that
map/filter/reduce is the right one. This militates in favour of change
in GPars and in Apache Groovy.

I guess this will now release the dogs of 'reduce vs. fold' war. :-)

We should note that reduce and fold tend to have different semantics in
the various functional languages and so this should be a non-debate it
is possible to have all of reduce, fold, foldr, foldl, and not be
confused (*).

(*) Well except that I can never remember the efficiency rules for
foldr and foldl so generally end up with the wrong one :-(

Dr Russel Winder      t: +44 20 7585 2200   voip:
41 Buckmaster Road    m: +44 7770 465 077   xmpp:
London SW11 1EN, UK   w:  skype: russel_winder

View raw message