Ramda.js R.__ Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

R.__ is a special placeholder that marks a gap in a curried function. It lets you supply arguments in any position now and fill the gap later (official Ramda docs).

Stable since v0.6.0: R.__ is not deprecated, experimental, or non-standard. It is a value you pass, not a function you call.

Syntax

Call R.__. Start with this line.

Ramda
fn(R.__, b) — a value, never R.__()
CallWhat it does
fn(R.__, b) — a value, never R.__()Primary usage.
R.__The placeholder value.

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

Library declarations
Ramda
fn(R.__, b) — a value, never R.__()

Parameters

This helper has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*The value returned by R.__.

Ramda Examples

Example 1 — Official greet Helper

Skip the middle argument of R.replace so the template stays fixed and the name comes later.

Ramda
const greet = R.replace('{name}', R.__, 'Hello, {name}!');

console.log(greet('Alice')); // "Hello, Alice!"
console.log(greet('Bob'));   // "Hello, Bob!"
Try It Yourself

How It Works

  1. Three slots. R.replace needs a pattern, a replacement, and a string.
  2. One gap. The pattern and string are given; R.__ holds the replacement slot open.
  3. Waiting function. With a gap left, greet is a function, not a string.
  4. Fill it. greet('Alice') fills the gap, so R.replace runs → 'Hello, Alice!'.

Example 2 — Half a Number with R.divide

Division order matters. The placeholder lets you fix the divisor instead of the dividend.

Ramda
const half = R.divide(R.__, 2);
const twoOver = R.divide(2);

console.log(half(10));    // 5
console.log(twoOver(10)); // 0.2
Try It Yourself

How It Works

  1. Signature. R.divide(a, b) returns a / b.
  2. With a gap. R.divide(R.__, 2) fixes b = 2 and leaves a open, so half(10) is 10 / 2 → 5.
  3. Without a gap. R.divide(2) fixes a = 2, so twoOver(10) is 2 / 10 → 0.2.
  4. Lesson. Use R.__ whenever the value you know is not the first argument.

Example 3 — Gaps Fill Left to Right

A small curried function shows exactly where each later value lands.

Ramda
const _ = R.__;
const join3 = R.curry((a, b, c) => a + '-' + b + '-' + c);

console.log(join3(_, 'b', _)('a', 'c'));   // "a-b-c"
console.log(join3(_, _, 'c')('a')('b'));   // "a-b-c"
console.log(join3(_, 'b')(_, 'c')('a'));   // "a-b-c"
Try It Yourself

How It Works

  1. Alias. _ is just a short name for R.__.
  2. Line 1. Gaps at slots 1 and 3. 'a' fills the first gap, 'c' the second.
  3. Line 2. Two gaps filled one call at a time: 'a', then 'b'.
  4. Line 3. join3(_, 'b') leaves slots 1 and 3 open; (_, 'c') fills slot 3 and keeps slot 1 open; ('a') fills it.

Example 4 — Your Own Functions Need R.curry

A plain function does not know about the placeholder. Wrap it first.

Ramda
const minus = (a, b) => a - b;
const curriedMinus = R.curry(minus);

console.log(minus(R.__, 5));            // NaN
console.log(curriedMinus(R.__, 5)(17)); // 12
Try It Yourself

How It Works

  1. Plain call. minus receives the placeholder object as a, so object - 5 → NaN.
  2. Wrap. R.curry(minus) makes a Ramda-curried version that checks for R.__.
  3. Gap. curriedMinus(R.__, 5) fixes b = 5 and waits for a.
  4. Fill. (17) → 17 - 5 → 12, the same as R.subtract(R.__, 5)(17).

Example 5 — Point-Free R.map and R.filter

A gapped helper is a one-argument function, so it drops straight into list functions.

Ramda
const minus5 = R.subtract(R.__, 5);
const isAdult = R.gt(R.__, 18);

console.log(R.map(minus5, [10, 20, 30]));    // [5, 15, 25]
console.log(R.filter(isAdult, [12, 20, 35])); // [20, 35]
Try It Yourself

How It Works

  1. minus5. R.subtract(R.__, 5) means x - 5.
  2. isAdult. R.gt(a, b) is a > b, so R.gt(R.__, 18) means x > 18.
  3. Map. R.map calls minus5 on each item → [5, 15, 25].
  4. Filter. R.filter keeps items where isAdult is true → [20, 35]. Without the gap, R.gt(18) would mean 18 > x and keep [12].

Browser & Runtime Support

R.__ is a plain JavaScript object inside Ramda 0.6.0+. No special browser API is needed.

✓ Ramda 0.6.0+ · Any JS runtime

Ramda.js R.__

The UMD build (ramda.min.js) is compiled to ES5 syntax, so the placeholder works in Chrome, Firefox, Safari, and Edge, and in Node.js, Deno, and Bun.

100% With Ramda 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.__ Universal

Bottom line: Safe in any project with Ramda 0.6.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.__ is a special placeholder value. Pass it to a curried Ramda function to leave a gap; a later call fills that gap. It is a value you pass, not a function you call.
const greet = R.replace('{name}', R.__, 'Hello, {name}!'); then greet('Alice') returns 'Hello, Alice!'. The placeholder skips the middle argument (the replacement) so you can supply the name later.
Normal currying always fills arguments from the left: R.divide(2) means 2 divided by the next value. R.__ lets you fix any position: R.divide(R.__, 2) means the next value divided by 2.
Left to right. In g(R.__, 'b', R.__)('a', 'c'), 'a' fills the first gap and 'c' fills the second. When every slot has a value, the original function runs.
No. Only Ramda's curried functions, or your own functions wrapped with R.curry or R.curryN, understand the placeholder. A plain function treats it as an ordinary object, which usually gives NaN or a wrong result.
No. R.__ has been a stable part of Ramda since v0.6.0. It is not deprecated, experimental, or non-standard.

Next: R.addIndex()

Give R.map and friends the current index, like Array.prototype.map.

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