Ramda.js R.liftN() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

R.liftN(n, fn) is R.lift with the arity written down. You pick how many lists (or other Apply values) the function should map over — even when fn.length is 0 or too small. Part of Ramda Function since v0.7.0 (stable — not deprecated).

Warning: Rest-parameter helpers report length === 0. R.lift would guess wrong — use R.liftN(n, fn) and name the arity yourself.

Syntax

Call R.liftN. Start with this line.

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

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

Library declarations
Ramda
R.liftN(n, fn)

Parameters

ParameterDescription
nRequired. Arity — number of lists / Apply values
fnRequired. Plain function (often variadic)

Return Value

Return ValueDescription
*Function that takes n lists / Apply values

Ramda Examples

Example 1 — Official madd3

Sum every combination from three lists with a rest-arg helper.

Ramda
const madd3 = R.liftN(3, (...args) => R.sum(args));

console.log(madd3([1, 2, 3], [1, 2, 3], [1]));
// → [3, 4, 5, 4, 5, 6, 5, 6, 7]
Try It Yourself

How It Works

  1. Arity 3. You pass 3 because the rest-arg summer has length 0.
  2. Combinations. Every pick from list1 × list2 × list3 is summed.
  3. Count. 3 × 3 × 1 = 9 results.
  4. Order. First list outermost — all 1+… before 2+….

Example 2 — Why Not R.lift?

A rest-arg function reports arity 0. You must write the 3.

Ramda
function addN() {
  return R.sum(Array.prototype.slice.call(arguments));
}

console.log(addN.length);
// → 0

console.log(R.liftN(3, addN)([1, 10], [2], [3]));
// → [6, 15]
Try It Yourself

How It Works

  1. length is 0. No named parameters → R.lift(addN) would use arity 0.
  2. liftN(3, …). You name three lists so the runner waits for them.
  3. Sums. 1+2+3 and 10+2+3 → [6, 15].
  4. Rule. Rest args / arguments → always prefer liftN.

Example 3 — Four Lists, Same addN

Reuse one variadic helper at a different arity.

Ramda
function addN() {
  return R.sum(Array.prototype.slice.call(arguments));
}

console.log(R.liftN(4, addN)([1, 10], [2], [3], [40]));
// → [46, 55]
Try It Yourself

How It Works

  1. Arity 4. Same addN, now waiting for four lists.
  2. Product. 2 × 1 × 1 × 1 = 2 results.
  3. Sums. 1+2+3+40 and 10+2+3+40.
  4. Reuse. One helper can be a 3-list or 4-list runner.

Example 4 — R.liftN Matches R.lift

When fn.length is correct, both helpers agree.

Ramda
function add3(a, b, c) {
  return a + b + c;
}

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

console.log(R.liftN(3, add3)([1, 10], [2], [3]));
// → [6, 15]
Try It Yourself

How It Works

  1. add3.length is 3. Lift reads that and waits for three lists.
  2. liftN(3, …). Same arity written by hand.
  3. Equal results. Both produce [6, 15].
  4. Prefer lift when named parameters already match — shorter.

Example 5 — Override Math.max.length

Math.max.length is 2, but you can lift it over three lists.

Ramda
console.log(Math.max.length);
// → 2

console.log(R.liftN(3, Math.max)([1, 9], [5], [2, 8]));
// → [5, 8, 9, 9]
Try It Yourself

How It Works

  1. Misleading length. Math.max reports 2 even though it accepts more.
  2. liftN(3, …). Force three lists: [1,9] × [5] × [2,8].
  3. Four maxes. max(1,5,2), max(1,5,8), max(9,5,2), max(9,5,8).
  4. Use case. Built-ins with wrong .length — always name the arity.

Browser & Runtime Support

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

✓ Stable · Ramda 0.7.0+

R.liftN()

Available in [email protected] full builds once the library is loaded. Works in evergreen browsers and current Node LTS when Ramda is installed. No extra browser API is required.

100% With Ramda 0.7.0+
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.liftN Ramda 0.7.0+

Bottom line: Safe for production once Ramda is loaded (CDN or npm). Prefer a modular build if you tree-shake. Use lift when fn.length already matches the arity you need.

Frequently Asked Questions

R.liftN(n, fn) lifts a function so it maps over n lists (or other Fantasy-Land Apply values). You choose the arity. The docs sample is R.liftN(3, (...args) => R.sum(args))([1,2,3], [1,2,3], [1]) //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]. Added in v0.7.0.
const madd3 = R.liftN(3, (...args) => R.sum(args)); madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]. A rest-arg summer has .length 0, so liftN(3, …) is required. Every combination of one number from each list is summed.
R.lift(fn) is R.liftN(fn.length, fn). Use lift when named parameters already match the number of lists. Use liftN when the function is variadic (rest args, arguments, Math.max) so .length is 0 or too small.
curryN(n, fn) still takes plain values. liftN(n, fn) takes n Apply values (usually lists) and runs fn on every combination. Internally liftN uses curryN, then reduces with R.ap.
The first list is the outermost loop, the last list is the innermost. For madd3([1,2,3], [1,2,3], [1]) you get 1+1+1, 1+2+1, 1+3+1, then 2+1+1, and so on.
No. R.liftN is a stable Ramda function helper from v0.7.0. It is not deprecated, experimental, or non-standard.

Next: R.memoizeWith()

Learn how to cache function results with a custom key function.

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