Skip to Content
Mastering JavaScript Functional Programming - Second Edition
book

Mastering JavaScript Functional Programming - Second Edition

by Federico Kereki
January 2020
Intermediate to advanced
470 pages
11h 13m
English
Packt Publishing
Content preview from Mastering JavaScript Functional Programming - Second Edition

Being functional

Now that we are nearing the end of this chapter, a confession is in order: I do not always use currying and partial application as shown above! Don't misunderstand me, I do apply those techniques—but sometimes it makes for longer, less clear, not necessarily better code. Let me show you what I'm talking about.

If I'm writing my own function and then I want to curry it in order to fix the first parameter, currying (or partial application, or partial currying) doesn't really make a difference, in comparison to arrow functions. I'd have to write the following:

const myFunction = (a, b, c) => { ... };const myCurriedFunction = curry(myFunction)(fixed_first_argument);// and later in the code...myCurriedFunction(second_argument)(third_argument); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering JavaScript Functional Programming

Mastering JavaScript Functional Programming

Federico Kereki

Publisher Resources

ISBN: 9781839213069Supplemental Content