Ramda.js R.partial() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

R.partial(fn, args) returns a new function that calls fn with the leftmost arguments already filled. Later calls supply the remaining arguments.

Stable: R.partial has been in Ramda since v0.10.0. It is not deprecated, experimental, or non-standard. The returned function is not auto-curried — see R.curry if you need that.

Syntax

Call R.partial. Start with this line.

Ramda
R.partial(fn, args)
CallWhat it does
R.partial(fn, args)Primary signature.
R.partial(...)Call the function helper.

Prefer import { partial } from "ramda" when you want a named import.

Library declarations
Ramda
R.partial(fn, args)

Parameters

ParameterDescription
fnRequired. Original function
argsRequired. Array of leftmost arguments to lock

Return Value

Return ValueDescription
*Plain function; arity ≈ fn.length - args.length

Ramda Examples

Example 1 — Official double

Lock the first factor as 2. Calling the result with 3 multiplies.

Ramda
const multiply2 = (a, b) => a * b;
const double = R.partial(multiply2, [2]);

console.log(double(3));
// → 6
Try It Yourself

How It Works

  1. Two-arg fn. multiply2 needs a and b.
  2. Lock left. R.partial(multiply2, [2]) stores 2 as a.
  3. Call. double(3) becomes multiply2(2, 3).
  4. Arity. The wrapper’s .length is 1 — one parameter still open.

Example 2 — Official Nested Greeting

Fill 'Hello', then 'Ms.', then pass the name.

Ramda
const greet = (salutation, title, firstName, lastName) =>
  salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';

const sayHello = R.partial(greet, ['Hello']);
const sayHelloToMs = R.partial(sayHello, ['Ms.']);

console.log(sayHelloToMs('Jane', 'Jones'));
// → 'Hello, Ms. Jane Jones!'
Try It Yourself

How It Works

  1. First lock. sayHello glues 'Hello' on the left.
  2. Second lock. sayHelloToMs glues 'Ms.' next.
  3. Final call. Supplies first and last name together.
  4. Nesting. The result of partial is a regular function, so you can partial it again.

Example 3 — Fill Two Left Arguments at Once

You do not have to nest. Put both known values in the list.

Ramda
const greet = (salutation, title, firstName, lastName) =>
  salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';

const sayHelloToMs = R.partial(greet, ['Hello', 'Ms.']);

console.log(sayHelloToMs.length);
// → 2

console.log(sayHelloToMs('Jane', 'Jones'));
// → 'Hello, Ms. Jane Jones!'
Try It Yourself

How It Works

  1. Arity. greet.length is 4; two list values leave two open.
  2. Wrapper length. sayHelloToMs.length is therefore 2.
  3. Same greeting. Nesting (example 2) and a longer list produce the same string.
  4. Style. Pick nest or one list — whichever reads clearer.

Example 4 — R.partial vs R.partialRight

Same subtraction. Left lock and right lock place the 3 in different slots.

Ramda
const sub = (a, b) => a - b;

console.log(R.partial(sub, [10])(3));
// → 7          // 10 - 3

console.log(R.partialRight(sub, [3])(10));
// → 7          // 10 - 3

console.log(R.partial(sub, [3])(10));
// → -7         // 3 - 10
Try It Yourself

How It Works

  1. Left. partial always prepends the list → 10 - 3.
  2. Right. partialRight appends → 10 - 3 with 3 last.
  3. Trap. partial(sub, [3])(10) is 3 - 10 because 3 sits in slot a.
  4. Pick. Use partialRight when known values belong at the end.

Example 5 — partial Does Not Wait Like curry

A three-argument add. partial runs immediately. curry waits for the missing value.

Ramda
const add3 = (a, b, c) => a + b + c;

console.log(R.partial(add3, [1])(2, 3));
// → 6

console.log(R.partial(add3, [1])(2));
// → NaN        // c is undefined

console.log(typeof R.curry(add3)(1)(2));
// → 'function'

console.log(R.curry(add3)(1)(2)(3));
// → 6
Try It Yourself

How It Works

  1. Full call. partial(add3, [1])(2, 3) supplies all three → 6.
  2. Short call. Passing only 2 leaves c undefined → NaN.
  3. Curry waits. curry(add3)(1)(2) is still a function.
  4. Rule. Use partial to lock a list; use curry to supply args one by one.

Browser & Runtime Support

R.partial is a Ramda Function helper since v0.10.0. It is plain JavaScript — no special browser API. It runs anywhere Ramda loads (CDN, npm, bundler).

✓ Stable · Ramda 0.10.0+

R.partial()

Available in Ramda builds from 0.10.0 onward. Works in evergreen browsers and current Node LTS / Bun / Deno when Ramda is installed.

100% With Ramda 0.10+
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
R.partial Ramda 0.10.0+

Bottom line: Safe for production once Ramda 0.10.0+ is loaded. Use a CDN build such as ramda.min.js in the browser, or npm install ramda for Node. No polyfill is needed beyond shipping Ramda itself.

Frequently Asked Questions

R.partial(fn, args) returns a new function. That new function calls fn with the args list first, then whatever you pass later. Symbolically: R.partial(f, [a, b])(c, d) = f(a, b, c, d). Added in v0.10.0. See also R.partialRight and R.curry.
double = R.partial(multiply2, [2]); double(3) //=> 6. Then a greet function: sayHello = R.partial(greet, ['Hello']); sayHelloToMs = R.partial(sayHello, ['Ms.']); sayHelloToMs('Jane', 'Jones') //=> 'Hello, Ms. Jane Jones!'.
partial takes a list of already-known left arguments and returns a plain function for the rest. That result is not auto-curried: missing later arguments become undefined. curry lets you supply arguments one at a time and waits until it has enough.
partial glues the list on the left. partialRight glues the list on the right. R.partial(sub, [10])(3) is 10 - 3. R.partialRight(sub, [3])(10) is also 10 - 3, because 3 is the last argument.
No. Only R.partial itself is curried (you may write R.partial(fn)(args)). The function it returns has arity Math.max(0, fn.length - args.length) and runs as soon as you call it.
No. R.partial is a stable Ramda Function helper from v0.10.0. It is not deprecated, experimental, or non-standard.

About the author

Next: R.partialObject()

Prefill some properties of an object argument, then supply the rest later.

R.partialObject() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful