Types and Functions 3: Composing

Then we get at Chapter 05: Composing and I really don’t understand the need to faff around so much when it comes to such a mathematically simple subject.

Composing is really easy, it’s just that programming languages make it hard. Especially if you look at this:

const compose = (...fns) => (...args) => fns.reduceRight((res, fn) => [fn.call(null, ...res)], args)[0];

That curried function is left unexplained and I’m still not sure I can read it.

I’m documenting this because every chapter is spawning off one too many bunny trails for my taste. That also makes it clear how learning functional programming is a reclusive undergrad’s game.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.