Ramda.js R.without() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
List

Definition

R.without(values, list) returns a new array containing every item of list that is not in values. Items are compared with R.equals, so objects match by value (official Ramda docs).

Stable since v0.19.0: R.without is not deprecated, experimental, or non-standard. It removes by value, drops every match, and never changes the input array.

Syntax

Call R.without. Start with this line.

Ramda
R.without(values, list) or R.without(values)(list)
CallWhat it does
R.without(values, list) or R.without(values)(list)Primary signature.
R.without(...)Call the list helper.

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

Library declarations
Ramda
R.without(values, list) or R.without(values)(list)

Parameters

ParameterDescription
valuesRequired. Array of values to remove; duplicates here make no difference
listOptional. The array to clean; omit it to get a reusable function

Return Value

Return ValueDescription
*A new array of the kept items, in their original order

Ramda Examples

Example 1 — Official: Remove Two Numbers

The sample from the Ramda docs: remove every 1 and 2.

Ramda
console.log(R.without([1, 2], [1, 2, 1, 3, 4]));
// [3, 4]
Try It Yourself

How It Works

  1. Values. The first array, [1, 2], lists what to throw away.
  2. Check. Each item of [1, 2, 1, 3, 4] is tested against those values.
  3. Drop. Both 1s and the 2 match, so all three are skipped.
  4. Result. Only 3 and 4 are left, in their original order.

Example 2 — Remove Every Match, Keep the Original

Clean a tag list. Every 'spam' goes, and the input array is unchanged.

Ramda
const tags = ['js', 'spam', 'css', 'spam', 'html'];
const clean = R.without(['spam'], tags);

console.log(clean);  // ['js', 'css', 'html']
console.log(tags);   // ['js', 'spam', 'css', 'spam', 'html']
Try It Yourself

How It Works

  1. Brackets. The single value still goes in an array: ['spam'].
  2. All matches. Both 'spam' entries (index 1 and 3) are removed.
  3. Order. 'js', 'css', and 'html' keep their relative order.
  4. No mutation. tags still has all five items; clean is a new array.

Example 3 — Objects Are Compared by Value

Remove a record using a look-alike object. Native includes cannot do this.

Ramda
const users = [
  { id: 1, name: 'Ana' },
  { id: 2, name: 'Ben' },
  { id: 3, name: 'Cy' }
];
const ben = { id: 2, name: 'Ben' };

console.log(R.pluck('name', R.without([ben], users)));
// ['Ana', 'Cy']

console.log(R.pluck('name', users.filter(u => ![ben].includes(u))));
// ['Ana', 'Ben', 'Cy']
Try It Yourself

How It Works

  1. A copy, not the same object. ben looks like users[1] but is a different object in memory.
  2. Ramda matches. R.without uses R.equals, which compares keys and values, so Ben is removed.
  3. Native misses. includes compares objects by reference, so nothing is removed.
  4. Display. R.pluck('name') just prints the names to keep the output short.

Example 4 — without vs difference

Both remove values, but the argument order is reversed and only difference removes duplicates.

Ramda
const nums = [3, 3, 4, 1];

console.log(R.without([1], nums));     // [3, 3, 4]
console.log(R.difference(nums, [1]));  // [3, 4]
Try It Yourself

How It Works

  1. without. Values to remove come first: R.without([1], nums).
  2. Keeps duplicates. Only 1 is removed, so both 3s stay.
  3. difference. The list comes first: R.difference(nums, [1]).
  4. Unique result. difference works like a set, so the second 3 is dropped too.

Example 5 — Remove Stop Words in a Pipeline

Leave out the list to get a reusable filter, then compose it.

Ramda
const dropStopWords = R.without(['a', 'the', 'of']);
const keywords = R.pipe(R.toLower, R.split(' '), dropStopWords, R.join(' '));

console.log(keywords('The Lord of the Rings'));  // lord rings
console.log(keywords('A Tale of Two Cities'));   // tale two cities
Try It Yourself

How It Works

  1. Curry. R.without(['a', 'the', 'of']) has no list yet, so it returns a function.
  2. Prepare. R.toLower and R.split(' ') turn the title into lowercase words.
  3. Filter. dropStopWords removes every 'the', 'of', and 'a'.
  4. Join. R.join(' ') glues the remaining words back into a string.

Browser & Runtime Support

R.without() is plain JavaScript inside Ramda 0.19.0+. Without Ramda, list.filter(x => !values.includes(x)) works in Chrome 47+, Firefox 43+, Safari 9+, and Node 6+, but includes compares objects by reference, not by value.

✓ Ramda 0.19.0+ · Any JS runtime

Ramda.js R.without()

The UMD build (ramda.min.js) is compiled to ES5 syntax, so it runs in Chrome, Firefox, Safari, and Edge, including older versions. Via npm it works in Node.js, Deno, and Bun.

100% With Ramda loaded
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
R.without() Universal

Bottom line: Safe in any project with Ramda (check with npm ls ramda). Load ramda.min.js from a CDN in the browser, or npm install ramda for Node, Deno, and Bun. These labs load [email protected].

Frequently Asked Questions

R.without(values, list) returns a new array with every item of list that appears in values removed. The official sample R.without([1, 2], [1, 2, 1, 3, 4]) returns [3, 4].
Yes. Every matching item is removed, not just the first one. To remove only one occurrence, find its index with R.indexOf, check that it is not -1, then call R.remove(index, 1, list).
No. It always builds and returns a new array, even when nothing is removed. The original list is left untouched.
Yes. It compares with R.equals, so objects and arrays match by value, not by reference. R.without([{ id: 2 }], [{ id: 1 }, { id: 2 }]) returns [{ id: 1 }]. The whole object must be equal; to match on one property, use R.reject(R.propEq(2, 'id'), list).
The argument order is reversed and difference removes duplicates. R.without([1], [3, 3, 4, 1]) keeps both 3s and returns [3, 3, 4], while R.difference([3, 3, 4, 1], [1]) returns [3, 4].
No. R.without has been a stable Ramda list function since v0.19.0. It is not deprecated, experimental, or non-standard.

Next: R.xprod()

Build every pair from two lists (the cross product).

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