Partial Application

Partial Application is a way for us to partially apply a function.

It is a process of producing a function with a smaller number of parameters. That means taking a function, applying some of it's argument in to the function and uses closures for later on calling the rest of the arguments.

Ex:
// curried varsion
const curriedMultiply = (a) => (b) => (c) => a * b * c;
curriedMultiply(5)(2)(2); // 20

// Partial Application
const multiply = (a, b, c) => a * b * c;
const partialMutliplyBy5 = multiply.bind(null, 5);
partialMutliplyBy5(2, 2) // 20

Last updated