Ramda Math Methods
About This Index
This page is the Ramda Math index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Learn the Ramda overview on /ramdajs. Use this page when you need a math API such as R.add(), R.sum(), or R.mathMod().
Start with R.add(), then R.subtract(), R.multiply(), and R.sum()—add R.mathMod() when you need wrap-around remainders.
How to Call a Math Method
Import R (or a named helper)—pairwise ops are curried and data goes last:
const R = require("ramda");
R.add(2, 3); // 5
R.subtract(10, 8); // 2
R.multiply(3, 4); // 12
R.divide(71, 100); // 0.71
R.inc(41); // 42
R.negate(5); // -5
R.sum([2, 4, 6, 8]); // 20
R.mean([2, 7, 9]); // 6
R.mathMod(-17, 5); // 3
const double = R.multiply(2);
double(21); // 42 Ramda Math Methods Table
All Math method guides in this Ramda tutorial series (13 tutorials).
Getting Started
4 methodsPairwise arithmetic in a Ramda tutorial — two numbers in, one number out.
| Method | Description | Tutorial |
|---|---|---|
R.add() | Adds two numbers. Curried; official R.add(2, 3) returns 5. | Try it |
R.subtract() | Subtracts the second number from the first. Official R.subtract(10, 8) returns 2. | Try it |
R.multiply() | Multiplies two numbers. Curried; used to build helpers like double and triple. | Try it |
R.divide() | Divides the first number by the second. Official R.divide(71, 100) returns 0.71. | Try it |
Remainder & Wrap
2 methodsJavaScript remainder versus true mathematical modulo for wrap-around indexes.
| Method | Description | Tutorial |
|---|---|---|
R.modulo() | JavaScript remainder (a % b). Official R.modulo(17, 3) returns 2. | Try it |
R.mathMod() | Mathematical modulo in 0 … p-1. Official R.mathMod(-17, 5) returns 3. | Try it |
Sign & Unit Steps
3 methodsFlip a sign or add/subtract one — unary and pipeline-ready.
List Totals
2 methodsFold a whole array into a sum or a product.
| Method | Description | Tutorial |
|---|---|---|
R.sum() | Adds every number in a list. Official R.sum([2, 4, 6, 8, 100, 1]) returns 121. | Try it |
R.product() | Multiplies every number in a list. Official R.product([2, 4, 6, 8, 100, 1]) returns 38400. | Try it |
Averages
2 methodsMean (sum / length) and median (middle sorted value).
| Method | Description | Tutorial |
|---|---|---|
R.mean() | Arithmetic average of a list. Official R.mean([2, 7, 9]) returns 6. | Try it |
R.median() | Middle value after sorting. Official R.median([2, 9, 7]) returns 7. | Try it |
Frequently Asked Questions
Start with R.add()
Open the add guide—syntax, examples, and FAQs.
16 people found this page helpful
