Challenge: Program without variables #javascript
Joel Thoms
1.5K13

Funny memories of the functional programming lessons many years ago. You discovered the killer app for this language from the type-less hell!

In your introduction to the U combinator, I stumbled over the expression sum(sum)(array.slice(1)), where sum(sum) looks pretty senseless. But of cause this is just U(sum), which would better express the intended recursiveness of the function:

U(sum => array => … array[0] + U(sum)(array.slice(1)))(…)

Like what you read? Give Bernhard Haumacher a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.