Ramda’s R.dec() takes a number and returns that number minus one. The official docs sample is a single call: R.dec(42) → 41. Added in v0.9.0. See also R.inc.
Because it is a first-class function, you can drop it into pipelines instead of writing n => n - 1. Internally Ramda computes n - 1, so JavaScript’s subtraction rules apply — numeric strings coerce, and invalid values become NaN.
Syntax
Call R.dec. Start with this line.
Ramda
R.dec(n)
Call
What it does
R.dec(n)
Primary signature.
R.dec(...)
Call the math helper.
Prefer import { dec } from "ramda" when you want a named import.
Library declarations
Ramda
R.dec(n)
Parameters
Parameter
Description
n
Required. the value to decrement. Ramda computes n - 1.
R.useWith runs R.dec on the first argument and R.inc on the second, then calls Math.pow. 3 becomes 2, 4 becomes 5, and 2 ** 5 is 32 — the official useWith sample.
Compatibility
Browser Support
R.dec() is plain JavaScript subtraction — 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.9.0+ · Any JS runtime
Ramda.js R.dec()
Load Ramda via CDN or npm, then call R.dec(n). Because it only uses n - 1, behavior is identical across engines.
100%With Ramda loaded
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
R.dec()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.dec(n) returns n - 1. It is Ramda's unary decrement helper — the functional equivalent of subtracting one — so you can pass it to R.map, R.pipe, or R.evolve without writing a lambda.
R.dec(42) returns 41. That is the sample on ramdajs.com/docs/#dec. Added in v0.9.0. See also R.inc.
Yes. It has arity 1 and is automatically curried. Call R.dec(42) for a number. Calling R.dec() with no argument returns a function that waits for n.
R.dec(n) is n - 1. R.inc(n) is n + 1. Subtraction coerces numeric strings to numbers (R.dec('10') is 9). Addition with + can concatenate (R.inc('10') is '101'). Prefer R.dec / R.inc when you mean minus-one or plus-one.
R.subtract(a, b) is a curried binary helper for a - b. R.dec(n) always subtracts 1. R.subtract(n, 1) matches R.dec(n) when both arguments are numbers.
No. R.dec is a stable Ramda math helper from v0.9.0. It is not deprecated, experimental, or non-standard.