Tom Ritchford
Sep 25, 2021

--

I disagree.

The functional approach has fewer characters, but at the cost of putting the complexity into reduce(), which you as the programmer have to tease out.

The code creates an anonymous function and then calls it on each element. It's significantly less straightforward and likely somewhat slower.

I'm a fan of functional programming, so it frustrates me when people show examples that don't actually show its power.

--

--

No responses yet