Skip to main content

Currying vs partial application

Partial application and currying are indeed similar - both techniques let you pass arguments to a function partially. But there is a clear difference in essence and purpose between them.


1. Definitions

Currying

Transforms a function with n arguments into a chain of functions, each of which takes exactly one argument.

javascript
// Original function function add(a, b, c) { return a + b + c; } // Curried version const curriedAdd = a => b => c => a + b + c; curriedAdd(1)(2)(3); // 6

Each call returns a new function that expects the next argument. Currying is a pure functional transformation of the signature.


Partial Application

Creates a new function with pre-set (partially applied) arguments, but does not change the number of arguments the function takes.

javascript
function add(a, b, c) { return a + b + c; } // Partially apply the first argument const add1 = add.bind(null, 1); add1(2, 3); // 6

Partial application simply fixes some of the arguments, and the rest can be passed later together.


2. The main difference

CriterionCurryingPartial Application
What it doesSplits the function into a chain of one-argument functionsFixes part of the original function's arguments
Arguments per step1 argument per callSeveral arguments can be passed at once
ReturnsA function expecting one next argumentA function expecting the remaining arguments
Call examplef(a)(b)(c)f(a, b)(c) or f(a)(b, c)
PurposeUnifying calls and compositionReusing a function with pre-set arguments

Example for clarity:

Currying:

javascript
const multiply = a => b => c => a * b * c; multiply(2)(3)(4); // 24

Partial application:

javascript
function multiply(a, b, c) { return a * b * c; } const double = multiply.bind(null, 2); // fix a=2 double(3, 4); // 24

Summary:

Currying is a formal transformation of a function into a sequence of one-argument calls. Partial Application is a practical technique for pre-filling part of the arguments and passing the rest later.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.