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

Currying by hand

Before trying more complex things, we could curry a function by hand, without any special auxiliary functions or anything else. And, in fact, if we just want to implement currying for a special case, there's no need to do anything complex, because we can manage with simple arrow functions: we saw that for both make3curried() and addVATcurried(), so there's no need to revisit that idea.

Instead, let's look into some ways of doing that automatically, so we will be able to produce an equivalent curried version of any function, even without knowing its arity beforehand. Going further, we might want to code a more intelligent version of a function that could work differently depending on the number of received arguments. For example, ...

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