Ramda.js R.multiply() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Math

Definition

Ramda’s R.multiply() multiplies two numbers. It is equivalent to a * b, but curried. The official docs samples are double(3) → 6, triple(4) → 12, and R.multiply(2, 5) → 10. Added in v0.1.0. See also R.divide.

Because multiplication is commutative, fixing the first argument is enough to name a scaler: R.multiply(2) is already “times two.” That is why the docs never need R.__ here — unlike R.divide.

Syntax

Call R.multiply. Start with this line.

Ramda
R.multiply(a, b)
CallWhat it does
R.multiply(a, b)Primary signature.
R.multiply(...)Call the math helper.

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

Library declarations
Ramda
R.multiply(a, b)

Parameters

ParameterDescription
aRequired. the first factor.
bRequired. the second factor.

Return Value

Return ValueDescription
*Returns a Number: a * b.

Ramda Examples

📚 Getting Started

The official 2 * 5 sample, then the official double and triple helpers.

Example 1 — The Official Docs Example

From ramdajs.com/docs/#multiply: R.multiply(2, 5) returns 10.

Ramda
R.multiply(2, 5);  //=> 10
R.multiply(5, 2);  //=> 10 (commutative)
R.multiply(2)(5);  //=> 10 (curried)
R.multiply(3, 4);  //=> 12
Try It Yourself

How It Works

R.multiply returns a * b. 2 * 5 is 10 — the official sample. Swapping to 5 * 2 is still 10 because multiplication is commutative. That is the big difference from R.divide.

Example 2 — Official double and triple

The docs build reusable scalers by fixing the first factor.

Ramda
var double = R.multiply(2);
var triple = R.multiply(3);

double(3);  //=> 6
triple(4);  //=> 12
double(2);  //=> 4
Try It Yourself

How It Works

R.multiply(2) returns a function that still needs the second factor. Calling it with 3 computes 2 * 3, which is 6 — the official double sample. You do not need R.__ here. R.multiply(2) already means “times two.”

📈 Practical Patterns

Map a double helper, pairwise products, and a scale-then-offset pipeline.

Example 3 — Point-Free Map with double

Drop the official double helper into R.map to scale every item.

Ramda
var double = R.multiply(2);

R.map(double, [1, 2, 3, 4, 5]);
//=> [2, 4, 6, 8, 10]
Try It Yourself

How It Works

double is a one-argument function, exactly the shape R.map wants. Each list item becomes the second factor; the first stays 2.

Example 4 — Pairwise Product with R.zipWith

Multiply matching items from two lists — quantities times unit prices.

Ramda
R.zipWith(R.multiply, [2, 3, 4], [10, 10, 10]);
//=> [20, 30, 40]

R.multiply(0, 99);  //=> 0
Try It Yourself

How It Works

R.zipWith calls R.multiply on each pair: 2*10, 3*10, 4*10. Multiplying by zero follows JavaScript: the product is 0.

Example 5 — Scale Then Offset with R.pipe

A common transform: multiply first, then add — the same idea as 2x + 1.

Ramda
R.pipe(R.multiply(2), R.add(1))(3);
//=> 7

R.pipe(R.multiply(3), R.add(1))(4);
//=> 13
Try It Yourself

How It Works

R.pipe runs left to right. 3 is doubled to 6, then R.add(1) makes 7. The second line is triple(4) + 1 → 13. Both helpers are curried, so they drop into the pipeline with no lambdas.

Browser Support

R.multiply() is plain JavaScript multiplication — it runs anywhere Ramda loads: every modern browser plus Node.js. Logos use the shared browser-image-sprite.png sprite from this project.

✓ Ramda 0.1.0+ · Any JS runtime

Ramda.js R.multiply()

Load Ramda via CDN or npm, then call R.multiply(a, b). Because it only uses a * b, behavior is identical across engines.

100% With Ramda loaded
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
R.multiply() 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.multiply(a, b) returns a * b. It is Ramda's curried multiplication helper — the functional equivalent of the * operator — so it can be partially applied and dropped into point-free pipelines.
The docs build const double = R.multiply(2) and const triple = R.multiply(3), then double(3) returns 6 and triple(4) returns 12. They also show R.multiply(2, 5) returning 10. Added in v0.1.0. See also R.divide.
Yes. R.multiply has arity 2 and is automatically curried, so R.multiply(2, 5) and R.multiply(2)(5) both return 10. Calling it with one argument returns a scaler — that is the official double / triple pattern.
Usually no. Multiplication is commutative, so R.multiply(2) already means “times 2.” Contrast with R.divide: R.divide(2) is 2 / n, not a half. You only need R.__ when you want to fill the second slot first.
R.multiply returns a * b and is commutative. R.divide returns a / b and is not. R.product multiplies every number in a list; R.multiply takes exactly two numbers (or a curried scaler).
No. R.multiply is a stable Ramda math helper from v0.1.0. It is not deprecated, experimental, or non-standard.

Continue to R.divide()

Learn quotients after you know how to multiply two numbers.

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