Ramda.js R.applyTo() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

Takes a value first, then a function, and returns f(x). Also known as the thrush combinator — pin a value, then pass functions. Part of Ramda Function since v0.25.0 (stable — not deprecated).

Note: Argument order is the reverse of a normal call: value → function. That makes R.applyTo(x) easy to reuse with many helpers.

Syntax

Call R.applyTo. Start with this line.

Ramda
R.applyTo(x, f) or R.applyTo(x)(f)
CallWhat it does
R.applyTo(x, f) or R.applyTo(x)(f)Primary signature.
R.applyTo(...)Call the function helper.

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

Library declarations
Ramda
R.applyTo(x, f) or R.applyTo(x)(f)

Parameters

ParameterDescription
xRequired. The value to feed into the function
fRequired. Unary function applied to x

Return Value

Return ValueDescription
*f(x)

Ramda Examples

Example 1 — Official t42

Pin 42, then apply identity and add-one.

Ramda
const t42 = R.applyTo(42);

t42(R.identity);  // → 42
t42(R.add(1));    // → 43
Try It Yourself

How It Works

  1. Pin. R.applyTo(42) stores the value.
  2. Identity. t42(R.identity) returns 42 unchanged.
  3. Add one. R.add(1) is a unary function; applied to 42 → 43.
  4. Reuse. Same pinned value, different functions — the thrush pattern.

Example 2 — Several Functions on One Value

Run identity, inc, and negate on the same pinned number.

Ramda
const t42 = R.applyTo(42);

t42(R.identity);  // → 42
t42(R.inc);       // → 43
t42(R.negate);    // → -42
Try It Yourself

How It Works

  1. One pin. Create t42 once.
  2. Pass helpers. Each call is helper(42).
  3. inc / negate. Produce 43 and -42.
  4. Why it helps. Avoid repeating the literal 42 for every transform.

Example 3 — R.applyTo vs R.call

Same result, opposite argument order.

Ramda
const plusOne = R.add(1);

R.call(plusOne, 42);       // → 43  (function first)
R.applyTo(42, plusOne);    // → 43  (value first)
Try It Yourself

How It Works

  1. Shared helper. plusOne is R.add(1).
  2. call. Function, then value → 43.
  3. applyTo. Value, then function → 43.
  4. Choose. Prefer applyTo when the value is fixed and functions vary.

Example 4 — String Helpers

Pin a string, then apply toUpper, toLower, and length.

Ramda
const t = R.applyTo("Ramda");

t(R.toUpper);  // → "RAMDA"
t(R.toLower);  // → "ramda"
t(R.length);   // → 5
Try It Yourself

How It Works

  1. Pin the string. R.applyTo("Ramda").
  2. Case helpers. Upper and lower each receive that string.
  3. Length. R.length returns 5.
  4. Same idea. Works for any unary Ramda string helper.

Example 5 — Map Over Functions

Run a list of functions on one pinned value with R.map.

Ramda
const fns = [R.identity, R.add(1), R.negate];

R.map(R.applyTo(42), fns);
// → [42, 43, -42]
Try It Yourself

How It Works

  1. List of functions. Three unary helpers.
  2. Curry applyTo. R.applyTo(42) is itself a function of f.
  3. map. Applies that to each helper → results array.
  4. Point-free fit. Natural when functions vary and the value is fixed.

Browser & Runtime Support

R.applyTo is a Ramda Function helper since v0.25.0. It runs anywhere Ramda runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install ramda.

✓ Stable · Ramda 0.25.0+

R.applyTo()

Available in full Ramda builds from v0.25.0 onward. Works in evergreen browsers and current Node LTS when Ramda is loaded.

100% With Ramda 0.25+
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.applyTo Ramda 0.25.0+

Bottom line: Safe for production once Ramda is loaded. Use it when one value meets many functions (thrush). Official reference: ramdajs.com/docs/#applyTo.

Frequently Asked Questions

R.applyTo(x, f) returns f(x). The value comes first, the function second. Official: const t42 = R.applyTo(42); t42(R.identity) → 42; t42(R.add(1)) → 43.
const t42 = R.applyTo(42); t42(R.identity); //=> 42; t42(R.add(1)); //=> 43. Added in v0.25.0. The docs also call this the thrush combinator.
In combinatory logic, thrush (T) is T x y = y x: apply the function y to the value x. R.applyTo(x)(f) is that combinator — pin the value, then pass functions.
Both compute f(x). R.call(f, x) is function first. R.applyTo(x, f) is value first. Use call when you already have the function; use applyTo when you want to reuse one value with many functions.
R.tap(f, x) runs f(x) for a side effect and still returns x. R.applyTo(x, f) returns f(x). Tap peeks; applyTo transforms.
No. R.applyTo is a stable Ramda Function helper from v0.25.0. It is not deprecated, experimental, or non-standard.

Next: R.ascend()

Turn a getter into an ascending comparator for R.sort and friends.

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

11 people found this page helpful