Ramda.js R.uncurryN() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

R.uncurryN(n, fn) returns a function of arity n from a manually curried function (official Ramda docs). A manually curried function is a chain of one-argument arrow functions like a => b => c => result. uncurryN lets you call it as fn(a, b, c) instead of fn(a)(b)(c) — the reverse of currying.

Stable since v0.14.0: R.uncurryN is not deprecated, experimental, or non-standard. Watch out: Ramda has no R.uncurry — you must always pass the depth n.

Syntax

Call R.uncurryN. Start with this line.

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

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

Library declarations
Ramda
R.uncurryN(n, fn)(...args)

Parameters

ParameterDescription
nRequired. How many nested layers to walk; also the arity of the result (0–10)
fnRequired. A manually curried function, such as a => b => result

Return Value

Return ValueDescription
*A Ramda-curried function that returns fn's final value once n arguments arrive

Ramda Examples

Example 1 — Official addFour

Wrap a chain of four one-argument functions, then pass all four numbers in one call.

Ramda
const addFour = a => b => c => d => a + b + c + d;

const uncurriedAddFour = R.uncurryN(4, addFour);

console.log(uncurriedAddFour(1, 2, 3, 4)); // 10
Try It Yourself

How It Works

  1. Count the layers. addFour has four arrows, so n is 4.
  2. Wrap once. R.uncurryN(4, addFour) returns a new function that expects four arguments.
  3. Feed each layer. Ramda passes 1 to the first arrow, 2 to the next, then 3 and 4.
  4. Result. The last layer adds them up: 1 + 2 + 3 + 4 = 10.

Example 2 — Why a Bare Nest Needs uncurryN

A nested arrow reads only its own parameter, so extra arguments are silently dropped.

Ramda
const addFour = a => b => c => d => a + b + c + d;

console.log(typeof addFour(1, 2, 3, 4));         // "function"
console.log(addFour(1)(2)(3)(4));                // 10
console.log(R.uncurryN(4, addFour)(1, 2, 3, 4)); // 10
Try It Yourself

How It Works

  1. Extras are ignored. addFour(1, 2, 3, 4) uses only 1 and returns b => …, a function.
  2. Stepwise works. addFour(1)(2)(3)(4) calls each layer separately → 10.
  3. uncurryN does the stepping for you. It splits (1, 2, 3, 4) and feeds one value per layer → 10.

Example 3 — Grouped Calls Still Work

The result is a Ramda-style curried function, so you can pass one or more arguments per call.

Ramda
const addFour = a => b => c => d => a + b + c + d;
const add = R.uncurryN(4, addFour);

console.log(add(1, 2)(3, 4)); // 10
console.log(add(1)(2, 3, 4)); // 10
console.log(add.length);      // 4
console.log(addFour.length);  // 1
Try It Yourself

How It Works

  1. Curried to arity 4. Internally, uncurryN wraps its walker with R.curryN(4, …).
  2. Collects arguments. add(1, 2) has only two, so it waits; (3, 4) completes the set → 10.
  3. Any grouping. add(1)(2, 3, 4) also reaches four arguments → 10.
  4. Lengths tell the story. add.length is 4, while each arrow in addFour has length 1.

Example 4 — Feed a Two-Argument API

R.zipWith calls its function as fn(x, y). A hand-curried helper needs uncurryN to fit.

Ramda
const greet = greeting => name => greeting + ', ' + name + '!';

console.log(typeof R.zipWith(greet, ['Hi'], ['Ada'])[0]); // "function"

const greet2 = R.uncurryN(2, greet);
console.log(R.zipWith(greet2, ['Hi', 'Hello'], ['Ada', 'Linus']));
// ["Hi, Ada!", "Hello, Linus!"]
Try It Yourself

How It Works

  1. Pairs up items. R.zipWith calls fn('Hi', 'Ada'), then fn('Hello', 'Linus').
  2. Without the wrap. greet('Hi', 'Ada') ignores 'Ada' and returns a function.
  3. With the wrap. greet2('Hi', 'Ada') sends 'Hi' to the first layer and 'Ada' to the second → 'Hi, Ada!'.
  4. Result. One greeting per pair: ["Hi, Ada!", "Hello, Linus!"].

Example 5 — n Must Match the Nest

If n is smaller than the number of layers, the walk stops early and you get a function back.

Ramda
const addFour = a => b => c => d => a + b + c + d;

console.log(typeof R.uncurryN(3, addFour)(1, 2, 3)); // "function"
console.log(R.uncurryN(3, addFour)(1, 2, 3)(4));     // 10
console.log(R.uncurryN(4, addFour)(1, 2, 3, 4));     // 10
Try It Yourself

How It Works

  1. Three layers walked. With n = 3, Ramda applies 1, 2, and 3, then stops.
  2. One layer left. The result is d => …, still waiting for d.
  3. Finish by hand. Calling it with (4) completes the sum → 10.
  4. Better fix. Use n = 4 so one call returns 10 directly.

Browser & Runtime Support

R.uncurryN() is plain JavaScript inside Ramda (available since v0.14.0). It uses no browser API, so support depends only on loading Ramda.

✓ Ramda 0.14.0+ · Any JS runtime

Ramda.js R.uncurryN()

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. The arrow functions in these examples need an ES2015+ engine, which every modern browser has.

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.uncurryN() Universal

Bottom line: Safe in any project that includes Ramda 0.14.0 or later. Load ramda.min.js from a CDN in the browser, or npm install ramda for Node, Deno, and Bun. These labs load [email protected] from jsDelivr.

Frequently Asked Questions

R.uncurryN(n, fn) takes a hand-curried function such as a => b => c => result and returns a function you can call with all the arguments at once, like fn(a, b, c). n tells Ramda how many nested layers to walk.
const addFour = a => b => c => d => a + b + c + d; then R.uncurryN(4, addFour)(1, 2, 3, 4) returns 10.
A nested arrow reads only its own parameter. addFour(1, 2, 3, 4) behaves like addFour(1): the extra arguments are ignored and you get back another function, not 10.
They go in opposite directions. R.curry starts from a normal multi-argument function and lets you pass arguments one at a time. R.uncurryN starts from a chain of one-argument functions and lets you pass the arguments together.
Every layer of a => b => c has a length of 1, so Ramda cannot tell how deep the chain goes. You must pass the depth yourself as n.
No. R.uncurryN has been a stable Ramda function helper since v0.14.0. It is not deprecated, experimental, or non-standard.

Next: R.useWith()

Run a separate transformer on each argument, then pass the results to one function.

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