Ramda.js Introduction

Beginner
6 min read
Updated: Oct 2026
Functional JS library

What Is Ramda.js?

Ramda is a practical functional programming library for JavaScript. Its helpers are automatically curried, data-last, and immutable—they return new values instead of mutating inputs.

Remember
Convention: import as R
  const R = require('ramda')
  import * as R from 'ramda'

Style:
  config / transform first → data last
  R.map(fn, list)   or   R.map(fn)(list)

Compose with:
  R.pipe(f, g, h)(data)   // left → right

These tutorials use [email protected]. Helpers span Math, List, Function, Object, Logic, Relation, and Type—ideal for point-free pipelines in React, Redux, and Node services.

Why Use Ramda?

You can write the same transforms with loops or Lodash. Ramda packages them as pure, composable functions that never touch your originals.

NeedHow Ramda helps
Reusable transformsCurry once: const doubleAll = R.map(n => n * 2)
Readable pipelinesR.pipe runs steps left to right
Safe updatesR.assoc / R.map return new data
Clear predicatesR.propEq(true, "active") names the rule

How a Ramda Call Runs

Think “build the tool, then pass the data”:

StepWhat happens
1. Loadnpm install ramda or a CDN script exposes R
2. ConfigureSupply transforms first: R.map(fn) or R.filter(pred)
3. Pass dataList or object is the final argument (or end of a pipe)
4. Get new valueOriginal input is unchanged; use the returned result

Your First Ramda Utility

Install via npm, or load from a CDN and double a list with R.map:

terminal
npm install ramda
HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Ramda R.map demo</title>
</head>
<body>
  <h1>Ramda.js R.map()</h1>
  <p>Doubled list:</p>
  <pre id="out"></pre>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ramda.min.js"></script>
  <script>
    function double(n) {
      return n * 2;
    }
    var result = R.map(double, [1, 2, 3]);
    document.getElementById("out").textContent = JSON.stringify(result);
  </script>
</body>
</html>
Try It Yourself

Node.js import

JavaScript
const R = require('ramda');
const process = R.pipe(
  R.filter(n => n > 2),
  R.map(n => n * 2),
  R.sum
);
console.log(process([1, 2, 3, 4])); // → 14

How It Works

1. Load. The CDN (or require) exposes the R object.

2. Transform first. R.map(double, list) applies double to each item.

3. Immutable. You get a new array; [1, 2, 3] is unchanged.

Next, explore numeric helpers in Ramda Math.

Ramda vs Lodash

Both help with data—different design goals:

RamdaLodash
StyleFP-first, data-lastUtility-first, often data-first
CurryingEvery function auto-curriedOptional / manual
MutationNever mutates inputsMostly immutable; some mutate
PipelinesR.pipe / R.compose_.flow / _.chain
MapR.map(fn, list)_.map(list, fn)

When to use which

Use Ramda when…Prefer Lodash when…
You want point-free R.pipe pipelinesYou want familiar _.map(list, fn) ergonomics
Immutability is a hard requirementYou need a larger grab-bag of everyday helpers
Your team leans functionalThe codebase already depends on Lodash

Core Building Blocks

These ideas show up in almost every Ramda script:

ConceptWhat it doesExample
CurryingPartial apply, then pass dataR.map(fn) → waits for list
Data-lastConfig first, data finalR.filter(pred, list)
R.__Placeholder for a middle argR.subtract(10, R.__)
R.pipeLeft-to-right compositionR.pipe(f, g, h)(x)
ImmutabilityAlways return new valuesR.assoc("k", v, obj)

Where Is Ramda Used?

Ramda fits FP-friendly JavaScript apps:

Use caseWhy Ramda fits
React / Redux stateR.assocPath and R.evolve without mutation
API data shapingPipe R.pluck, R.groupBy, and R.map
Named transformsDefine once, compose with R.pipe, pass data last
Validation rulesR.allPass, R.anyPass, R.propSatisfies
Node servicesPure helpers that are easy to test
Teaching FPClear currying and composition patterns

Key Takeaways

  • Ramda is FP-first: curried, data-last, immutable.
  • Pattern: R.map(fn, list) or R.pipe(...)(data).
  • Prefer R.pipe for left-to-right readability.
  • Not Lodash: argument order is different—data comes last.

One line: Ramda turns data work into pure pipelines—next, try Math methods.

Frequently Asked Questions

Ramda is a practical functional programming library for JavaScript. Its helpers are automatically curried, data-last, and immutable—they return new values instead of mutating inputs. The official docs organize helpers into Math, List, Function, Object, Logic, Relation, and Type categories.
Lodash is a general-purpose utility library with a data-first API. Ramda is FP-first: every function is curried, data comes last, and nothing mutates. Choose Ramda when you want point-free pipelines with R.pipe; choose Lodash when you want familiar _.map(list, fn) ergonomics.
Currying means you can call a function with fewer arguments than it needs and get back a new function waiting for the rest. R.map(fn, list) can be written as R.map(fn)(list). Ramda curries every function automatically so you can partially apply transforms before data arrives.
Both combine functions into one. R.pipe runs left to right—the first function runs first. R.compose runs right to left—like mathematical composition f(g(x)). Prefer pipe when you want top-to-bottom readability.
No. Ramda helpers return new arrays, objects, and values. R.assoc, R.map, R.filter, and R.adjust never change the original. This immutability makes pipelines predictable in React, Redux, and other FP-friendly codebases.
Open the Math hub for numeric helpers, then List for R.map, R.filter, and R.reduce. Continue to Function for R.pipe and R.compose, Object for R.assoc and R.path, and Relation for R.propEq and R.equals.

Did you know?

Ramda is automatically curried, data-last, and immutable—pass data last, get new values back, and compose with R.pipe and R.compose. These tutorials use [email protected].

Next: Ramda Math

Practice the first category of helpers—numbers and arithmetic.

Math methods →

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.

8 people found this page helpful