Ramda.js R.divide() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Math

Definition

Ramda’s R.divide() takes two values and returns a / b. The official docs sample is R.divide(71, 100) → 0.71. Added in v0.1.0. See also R.multiply.

Because Ramda functions are automatically curried, you can lock in one argument and reuse the rest. The docs show two patterns beginners should memorize: R.divide(R.__, 2) builds a half function (the placeholder waits for the first argument), and R.divide(1) builds a reciprocal function.

Syntax

Call R.divide. Start with this line.

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

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

Library declarations
Ramda
R.divide(a, b)

Parameters

ParameterDescription
aRequired. the dividend (the value being divided). First argument.
bRequired. the divisor (the value you divide by). Second argument.

Return Value

Return ValueDescription
*Returns a Number: a / b.

Ramda Examples

📚 Getting Started

The official 71 / 100 sample, then the official half helper.

Example 1 — The Official Docs Example

From ramdajs.com/docs/#divide: R.divide(71, 100) returns 0.71.

Ramda
R.divide(71, 100);  //=> 0.71
R.divide(10, 2);    //=> 5
R.divide(2, 10);    //=> 0.2
R.divide(71)(100);  //=> 0.71 (curried)
Try It Yourself

How It Works

R.divide returns a / b. 71 / 100 is 0.71 — the official sample. Swapping to 2 / 10 gives 0.2, which is why argument order matters.

Example 2 — Official half with R.__

The docs build a reusable half function by filling the divisor and waiting for the dividend.

Ramda
var half = R.divide(R.__, 2);

half(42);  //=> 21
half(10);  //=> 5

// Without the placeholder, R.divide(2) waits for the divisor:
R.divide(2)(42);  //=> 2 / 42  (not a half)
Try It Yourself

How It Works

R.__ says “skip this slot.” R.divide(R.__, 2) stores the divisor 2 and waits for a. Plain R.divide(2) stores the dividend instead, so R.divide(2)(42) is 2 / 42, not a half.

📈 Practical Patterns

Official reciprocals, mapping a half helper, and pairwise divide.

Example 3 — Official Reciprocal

Fix the dividend at 1 to get 1 / n.

Ramda
var reciprocal = R.divide(1);

reciprocal(4);   //=> 0.25
reciprocal(2);   //=> 0.5
reciprocal(1);   //=> 1
Try It Yourself

How It Works

R.divide(1) is a function that still needs b. Calling it with 4 computes 1 / 4, which is 0.25 — the official reciprocal sample.

Example 4 — Point-Free Map with half

Drop the official half helper into R.map to divide every item by 2.

Ramda
var half = R.divide(R.__, 2);

R.map(half, [10, 20, 30]);
//=> [5, 10, 15]
Try It Yourself

How It Works

half is a one-argument function, exactly the shape R.map wants. Each list item becomes the dividend; the divisor stays 2.

Example 5 — Pairwise Divide with R.zipWith

Divide matching items from two lists — numerators over denominators.

Ramda
R.zipWith(R.divide, [10, 20, 40], [2, 4, 5]);
//=> [5, 5, 8]

R.divide(1, 0);  //=> Infinity
Try It Yourself

How It Works

R.zipWith calls R.divide on each pair: 10/2, 20/4, 40/5. Dividing by zero follows JavaScript: 1 / 0 is Infinity. Guard divisors in real data.

Browser Support

R.divide() is plain JavaScript division — 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.divide()

Load Ramda via CDN or npm, then call R.divide(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.divide() 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.divide(a, b) returns a / b. It is Ramda's curried division helper — the functional equivalent of the / operator — so it can be partially applied and dropped into point-free pipelines.
R.divide(71, 100) returns 0.71. The docs also show const half = R.divide(R.__, 2) with half(42) returning 21, and const reciprocal = R.divide(1) with reciprocal(4) returning 0.25. Added in v0.1.0. See also R.multiply.
Yes. R.divide has arity 2 and is automatically curried, so R.divide(71, 100) and R.divide(71)(100) both return 0.71. Calling it with one argument returns a function that waits for the divisor.
R.__ is Ramda's placeholder. R.divide(R.__, 2) fills the second argument (the divisor) and waits for the first. That is how the official half helper works: half(42) is 42 / 2.
R.divide returns a / b; R.multiply returns a * b. Division is not commutative: R.divide(10, 2) is 5, while R.divide(2, 10) is 0.2. Multiply does not care about order.
No. R.divide is a stable Ramda math helper from v0.1.0. It is not deprecated, experimental, or non-standard.

Continue to R.modulo()

Learn remainders after you know how to divide two numbers.

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