Performs right-to-left function composition (official Ramda docs). The last argument may have any arity; the remaining arguments must be unary. You get one new function that runs the rightmost step first.
Stable since v0.1.0:R.compose is a core Ramda helper — not deprecated, experimental, or non-standard. The result is not auto-curried. Prefer R.pipe when left-to-right reads clearer.
Syntax
Call R.compose. Start with this line.
Ramda
R.compose(f, g, h)
Call
What it does
R.compose(f, g, h)
Primary signature.
R.compose(...)
Call the function helper.
Prefer import { compose } from "ramda" when you want a named import.
Library declarations
Ramda
R.compose(f, g, h)
Parameters
Parameter
Description
…functions
Required. Rightmost may be multi-arg; others must be unary
Return Value
Return Value
Description
*
One function with the arity of the rightmost step
Ramda Examples
Example 1 — Official Math Pipeline
Multiply, add, then take absolute value — right to left.
Ramda
const result = R.compose(Math.abs, R.add(1), R.multiply(2))(-4);
console.log(result); // 7
Trim first (right).R.trim removes leading/trailing spaces.
Lowercase.R.toLower → 'hello world'.
Replace last (left). Spaces become hyphens → 'hello-world'.
Read bottom-up in the list. Rightmost runs first; leftmost finishes.
Compatibility
Browser & Runtime Support
R.compose() is ordinary JavaScript once Ramda is loaded. It needs no special browser API — only a JS runtime that can run Ramda (v0.1.0+).
✓ Ramda 0.1.0+ · Any JS runtime
Ramda.js R.compose()
Works in every modern browser and runtime where you can load Ramda (CDN or npm). Internet Explorer needs a build that targets that environment; there is no native IE API to polyfill.
100%With Ramda loaded
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
R.compose()Universal
Bottom line: Safe in any project that includes Ramda 0.1.0 or later. Load ramda.min.js from a CDN in the browser, or npm install ramda for Node, Bun, and Deno.
Frequently Asked Questions
R.compose(f, g, h) returns a new function that runs right to left: h first, then g, then f. The last argument may take several values; every function before it must be unary. The result is not automatically curried.
R.compose(R.toUpper, classyGreeting)('James', 'Bond') yields "THE NAME'S BOND, JAMES BOND". The math sample is R.compose(Math.abs, R.add(1), R.multiply(2))(-4) which yields 7. Added in v0.1.0. See also R.pipe.
They chain the same way, but in opposite directions. compose is right-to-left (last function runs first). pipe is left-to-right (first function runs first). R.pipe(multiply(2), add(1), Math.abs)(-4) is the same 7 as the compose sample with the list reversed.
No. The docs note that the result of compose is not automatically curried. Call it with every argument the rightmost function needs, in one go: yellGreeting('James', 'Bond'), not yellGreeting('James')('Bond').
Only the last (rightmost) function. The remaining functions must be unary: each receives the previous result as a single value.
No. R.compose is a stable Ramda function helper from v0.1.0. It is not deprecated, experimental, or non-standard.