Ramda’s R.add() takes two values and returns their sum. On its own that sounds like the humble + operator — but because Ramda functions are automatically curried, R.add can be handed just one argument to produce a brand-new function that adds that number to whatever comes next.
That currying is what makes R.add shine in functional pipelines. Instead of writing x => x + 1, you can write R.add(1) and feed it directly to R.map or R.pipe. Internally Ramda computes Number(a) + Number(b), so numeric strings are coerced before they are added.
Syntax
Call R.add. Start with this line.
Ramda
R.add(a, b)
Call
What it does
R.add(a, b)
Primary signature.
R.add(...)
Call the math helper.
Prefer import { add } from "ramda" when you want a named import.
Library declarations
Ramda
R.add(a, b)
Parameters
Parameter
Description
a
Required. the first value to add. Coerced with Number(a).
b
Required. the second value to add. Coerced with Number(b).
Return Value
Return Value
Description
*
Returns a Number: the sum Number(a) + Number(b).
Ramda Examples
📚 Getting Started
Add two numbers and use Ramda’s automatic currying.
Example 1 — Add Two Numbers
The classic Ramda intro: pass both operands and get their sum back.
Because R.add has arity 2 and is curried, calling it with one number returns a function that remembers that number. add7 then adds 7 to any value you give it later.
📈 Practical Patterns
Coercion behavior, point-free mapping, and list totals.
Example 3 — Numeric Coercion
Unlike the raw + operator, Ramda coerces both arguments with Number(), so numeric strings add up instead of concatenating.
Ramda
R.add('1', '2'); //=> 3 (not '12')
R.add('10', 5); //=> 15
R.add('foo', 1); //=> NaN (cannot coerce)
// Compare with the + operator:
'1' + '2'; //=> '12'
R.reduce threads an accumulator through the list, calling R.add(acc, item) each step. Starting from 0, it produces 0+10+20+30 = 60 — the same result R.sum gives in one call.
Compatibility
Browser & Runtime Support
R.add() is plain JavaScript arithmetic — it runs anywhere Ramda loads: every modern browser plus Node.js, Deno, and Bun. Ramda has no runtime dependencies.
✓ Ramda 0.1.0+ · Any JS runtime
Ramda.js R.add()
Load Ramda via CDN or npm, then call R.add. Because it only uses Number() and +, behavior is identical across engines.
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.add()Universal
Bottom line: Safe in any project that includes Ramda. Use a CDN build such as ramda.min.js in the browser or install ramda from npm for Node.
Frequently Asked Questions
R.add(a, b) returns the sum of two values. It is Ramda's curried addition helper — the functional equivalent of the + operator — so it can be partially applied and dropped into point-free pipelines.
Yes. R.add has arity 2 and is automatically curried, so R.add(7, 10) and R.add(7)(10) both return 17. Calling it with one argument returns a new function that waits for the second number.
Yes. Internally Ramda computes Number(a) + Number(b), so numeric strings are converted before adding: R.add('1', '2') is 3, not '12'. Values that cannot be coerced (like 'foo') produce NaN.
R.add adds exactly two values, while R.sum adds every number in a list: R.sum([1, 2, 3]) is 6. Use R.add with R.reduce when you need finer control over the accumulation.
R.add returns a + b; R.subtract returns a - b. Both are curried binary math helpers. Note that R.subtract is not commutative, so argument order matters more there.
Yes. R.add(1) returns a function that adds one to whatever you pass it — the same idea as R.inc. R.map(R.add(1), [1, 2, 3]) yields [2, 3, 4].