Ramda Math Methods

Beginner
6 min read
Updated: Nov 2026
13 method guides
Method index

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

Beginner path.

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:

Ramda
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 methods

Pairwise arithmetic in a Ramda tutorial — two numbers in, one number out.

MethodDescriptionTutorial
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 methods

JavaScript remainder versus true mathematical modulo for wrap-around indexes.

MethodDescriptionTutorial
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 methods

Flip a sign or add/subtract one — unary and pipeline-ready.

MethodDescriptionTutorial
R.negate()Flips the sign of a number. Official R.negate(42) returns -42.Try it
R.inc()Adds one. Official R.inc(42) returns 43. Unary and pipeline-ready.Try it
R.dec()Subtracts one. Official R.dec(42) returns 41. Unary and pipeline-ready.Try it

List Totals

2 methods

Fold a whole array into a sum or a product.

MethodDescriptionTutorial
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 methods

Mean (sum / length) and median (middle sorted value).

MethodDescriptionTutorial
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

They are curried helpers for arithmetic (add, subtract, multiply, divide), remainders (modulo, mathMod), unary steps (inc, dec, negate), and list folds (sum, product, mean, median). None mutate the input.
R.add(a, b) adds exactly two numbers. R.sum(list) adds every number in an array—same idea as R.reduce(R.add, 0, list).
Use R.modulo for JavaScript remainder (a % b), which can be negative. Use R.mathMod for wrap-around indexes: R.mathMod(-17, 5) is 3, while R.modulo(-17, 5) is -2.
Yes. Pairwise helpers have arity 2, so R.add(1) waits for the second number. List helpers have arity 1. Placeholders (R.__) fill the second slot when order matters.
Start with R.add(), then R.subtract(), R.multiply(), and R.sum() from the table below.

Start with R.add()

Open the add guide—syntax, examples, and FAQs.

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

16 people found this page helpful