Ramda.js R.converge() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

R.converge(after, functions) builds a new function that runs every branching function on the same arguments, then passes those results to after. Part of Ramda Function since v0.4.2 (stable — not deprecated).

Stable: Added in Ramda v0.4.2. Not deprecated, experimental, or non-standard. See also R.useWith.

Syntax

Call R.converge. Start with this line.

Ramda
R.converge(after, functions)
CallWhat it does
R.converge(after, functions)Primary signature.
R.converge(...)Call the function helper.

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

Library declarations
Ramda
R.converge(after, functions)

Parameters

ParameterDescription
afterRequired. Called with each branch result, in array order
functionsRequired. Array of branching functions (same args each)

Return Value

Return ValueDescription
*New function; arity = longest branch

Ramda Examples

Example 1 — Official Average

Divide sum by length. Both branches read the same list.

Ramda
const average = R.converge(R.divide, [R.sum, R.length]);

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

How It Works

  1. Build the helper. after is R.divide; branches are sum then length.
  2. Fan out. Both branches receive [1..7].
  3. Branch results. sum → 28, length → 7.
  4. Fan in. R.divide(28, 7) → 4.

Example 2 — Official strangeConcat

Uppercase and lowercase the same string, then concatenate.

Ramda
const strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower]);

console.log(strangeConcat("Yodel"));
// → "YODELyodel"
Try It Yourself

How It Works

  1. One string in. Both branches see "Yodel".
  2. Two views. toUpper → "YODEL", toLower → "yodel".
  3. Combine. R.concat glues them in branch order.
  4. Result. "YODELyodel" — same idea as the average sample, for strings.

Example 3 — Join Two Object Fields

Read first and last from the same record, then join with a space.

Ramda
const fullName = R.converge(
  (first, last) => first + " " + last,
  [R.prop("first"), R.prop("last")]
);

console.log(fullName({ first: "Ada", last: "Lovelace" }));
// → "Ada Lovelace"
Try It Yourself

How It Works

  1. Unary branches. Each R.prop needs one object, so fullName is unary.
  2. Same record. Both props read from { first, last }.
  3. Order. First branch → first name; second → last name.
  4. Combine. The arrow joins them with a space → "Ada Lovelace".

Example 4 — Same Arguments, Two Math Branches

Add and subtract the same pair, then multiply. Arity is 2 because the longest branch is binary.

Ramda
const productOfSumAndDiff = R.converge(R.multiply, [R.add, R.subtract]);

console.log(productOfSumAndDiff(5, 3));
// → 16

console.log(productOfSumAndDiff(5)(3));
// → 16
Try It Yourself

How It Works

  1. Same pair. Both add and subtract receive 5 and 3.
  2. Branch math. add → 8, subtract → 2.
  3. Combine. multiply(8, 2) → 16.
  4. Not useWith. This is not “add gets 5, subtract gets 3” — both get the full list. Curried call (5)(3) works too.

Example 5 — R.converge vs Handwritten Average

Same math as Example 1, written two ways — both yield 4.

Ramda
const list = [1, 2, 3, 4, 5, 6, 7];

const average = R.converge(R.divide, [R.sum, R.length]);
const manual = (xs) => R.divide(R.sum(xs), R.length(xs));

console.log(average(list));
// → 4

console.log(manual(list));
// → 4
Try It Yourself

How It Works

  1. Same steps. Both call sum, then length, then divide.
  2. Named helper. Converge keeps the pattern reusable and point-free.
  3. Inline form. The lambda is fine for a one-off.
  4. Choose. Prefer converge when you already have named branches and a named combiner.

Browser & Runtime Support

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

✓ Stable · Ramda 0.4.2+

R.converge()

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.4.2+
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.converge Ramda 0.4.2+

Bottom line: Safe for production once Ramda is loaded (CDN or npm). Prefer a modular build if you tree-shake. IE and very old engines are fine only if your Ramda bundle targets them.

Frequently Asked Questions

R.converge(after, functions) returns a new function. Each branching function is called with the same arguments. Those results become the arguments to after, which produces the final value.
const average = R.converge(R.divide, [R.sum, R.length]); average([1, 2, 3, 4, 5, 6, 7]) yields 4. const strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower]); strangeConcat('Yodel') yields YODELyodel. Added in v0.4.2.
Yes. Every branching function is applied to the same input. That is the opposite of R.useWith, which transforms each argument separately before the main function.
converge feeds branch results into one function (after). applySpec puts each result on a named key of an object. Same fan-out idea; different shape of the answer.
The same as the longest branching function. If both R.sum and R.length are unary, average is unary. If the branches are R.add and R.subtract, the result is binary.
No. R.converge is a stable Ramda function helper from v0.4.2. It is not deprecated, experimental, or non-standard.

Next: R.curry()

Learn how to wrap functions so they wait for arguments one at a time.

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

12 people found this page helpful