7

Transforming Functions – Currying and Partial Application

In Chapter 6, Producing Functions, we saw several ways of manipulating functions to get new versions with some changes in their functionality. In this chapter, we will go into a particular kind of transformation, a sort of factory method that lets you produce new versions of any given function.

We will be considering the following:

  • Currying: A classic FP theoretical function that transforms a function with many parameters into a sequence of unary functions
  • Partial application: Another time-honored FP transformation, which produces new versions of functions by fixing some of their arguments
  • Partial currying (a name of my own): Can be seen as a mixture of the two previous transformations ...

Get Mastering JavaScript Functional Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.