Ramda.js R.partialRight() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

R.partialRight(fn, args) locks the last arguments of fn and returns a new function. When you call that function, your new arguments go first and the locked list goes last (official Ramda docs).

Stable since v0.10.0: R.partialRight is not deprecated, experimental, or non-standard. Its left-side twin is R.partial.

Syntax

Call R.partialRight. Start with this line.

Ramda
R.partialRight(fn, [y, z])
CallWhat it does
R.partialRight(fn, [y, z])Primary signature.
R.partialRight(...)Call the function helper.

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

Library declarations
Ramda
R.partialRight(fn, [y, z])

Parameters

ParameterDescription
fnRequired. The function to specialize
argsRequired. Values placed after the ones you pass later

Return Value

Return ValueDescription
*A function with .length = fn.length - args.length

Ramda Examples

Example 1 — Official Greeting

Lock the title and name; pass only the salutation later. This is the sample from the Ramda docs.

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

const greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']);

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

How It Works

  1. Lock. ['Ms.', 'Jane', 'Jones'] is stored for the last three parameters.
  2. Call. 'Hello' is the only new argument, so it goes first.
  3. Join. Ramda runs greet('Hello', 'Ms.', 'Jane', 'Jones').
  4. Reuse. greetMsJaneJones('Hi') works too — only the salutation changes.

Example 2 — Lock the Divisor

Same locked value, opposite side: right gives “divide by 2”, left gives “2 divided by”.

Ramda
const halve = R.partialRight(R.divide, [2]);
const twoOver = R.partial(R.divide, [2]);

console.log(halve(10));   // 5    → 10 / 2
console.log(twoOver(10)); // 0.2  → 2 / 10
Try It Yourself

How It Works

  1. Right lock. halve(10) runs R.divide(10, 2) → 5.
  2. Left lock. twoOver(10) runs R.divide(2, 10) → 0.2.
  3. Order matters. For non-commutative math like division, pick the side that matches the formula.
  4. Curried input is fine. R.divide is already curried; halve.length is 1.

Example 3 — Lock Two Right Arguments

Lock only the name. Two parameters stay open on the left — check .length.

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

const greetJaneJones = R.partialRight(greet, ['Jane', 'Jones']);

console.log(greetJaneJones.length);          // 2
console.log(greetJaneJones('Hello', 'Ms.')); // "Hello, Ms. Jane Jones!"
Try It Yourself

How It Works

  1. Arity. greet has 4 parameters; 2 are locked, so .length is 4 - 2 = 2.
  2. Call. 'Hello' and 'Ms.' fill the first two slots, in order.
  3. Join. The locked 'Jane', 'Jones' are appended after them.
  4. Same result. You chose how much to lock; the final call is identical to Example 1.

Example 4 — Parse Binary Strings with R.map

Lock parseInt’s radix on the right to get a one-argument “parse binary” helper.

Ramda
const parseBinary = R.partialRight(parseInt, [2]);

console.log(R.map(parseBinary, ['10', '11', '111'])); // [2, 3, 7]
Try It Yourself

How It Works

  1. Lock the radix. parseInt(string, radix) gets 2 as its last argument.
  2. Map. R.map passes only each item, so parseBinary('11') runs parseInt('11', 2) → 3.
  3. Result. '10', '11', '111' become 2, 3, 7.
  4. Watch out. Native Array.prototype.map passes extra arguments — see Edge Cases.

Example 5 — R.partialRight Does Not Wait Like R.curry

The returned function runs on the first call, even if arguments are missing.

Ramda
const add3 = (a, b, c) => a + b + c;
const plus3 = R.partialRight(add3, [3]);

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

How It Works

  1. Full call. plus3(1, 2) runs add3(1, 2, 3) → 6.
  2. Short call. plus3(1) runs add3(1, 3); c is undefined, so the sum is NaN.
  3. Curry waits. R.curry(add3) keeps collecting until all three arguments arrive.
  4. Rule of thumb. Pass every remaining argument in one call, or use R.curry.

Browser & Runtime Support

R.partialRight() is plain JavaScript inside Ramda 0.10.0+. It uses no browser API, so support depends only on loading Ramda.

✓ Ramda 0.10.0+ · Any JS runtime

Ramda.js R.partialRight()

The UMD build (ramda.min.js) is compiled to ES5 syntax, so it runs in Chrome, Firefox, Safari, and Edge. Via npm it works in Node.js, Deno, and Bun with require or import.

100% With Ramda 0.10+ loaded
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.partialRight() Universal

Bottom line: Safe in any project with Ramda 0.10.0 or later (check with npm ls ramda). Load ramda.min.js from a CDN in the browser, or npm install ramda for Node, Deno, and Bun. These labs load [email protected].

Frequently Asked Questions

R.partialRight(fn, args) locks the last arguments of fn and returns a new function. Arguments you pass later go first, then the locked list: R.partialRight(f, [a, b])(c, d) is f(c, d, a, b).
const greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']); greetMsJaneJones('Hello') returns 'Hello, Ms. Jane Jones!'. The title and name are locked on the right; only the salutation is left.
R.partial locks arguments on the left, R.partialRight locks them on the right. With divide = (a, b) => a / b, R.partialRight(divide, [2])(10) is 10 / 2 = 5, while R.partial(divide, [2])(10) is 2 / 10 = 0.2.
No. Only R.partialRight itself is curried, so R.partialRight(fn)(args) works. The function it returns runs as soon as you call it; any missing arguments become undefined. Use R.curry when you want to pass arguments one call at a time.
No. Placeholders belong to curried functions. R.partialRight only appends a plain list of values. To leave a gap in the middle, curry the function and use R.__ instead.
No. R.partialRight has been a stable Ramda function helper since v0.10.0. It is not deprecated, experimental, or non-standard.

Next: R.pipe()

Send a value through several functions from left to right.

R.pipe() 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.

6 people found this page helpful