Ramda.js R.remove() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
List

Definition

R.remove(start, count, list) returns a new array with count items taken out, beginning at index start. Think of it as an immutable splice: the original list stays exactly as it was (official Ramda docs).

Stable since v0.2.2: R.remove is not deprecated, experimental, or non-standard. It removes by position, not by value, and never changes the input array.

Syntax

Call R.remove. Start with this line.

Ramda
R.remove(start, count, list) or R.remove(start, count)(list)
CallWhat it does
R.remove(start, count, list) or R.remove(start, count)(list)Primary signature.
R.remove(...)Call the list helper.

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

Library declarations
Ramda
R.remove(start, count, list) or R.remove(start, count)(list)

Parameters

ParameterDescription
startRequired. Index of the first item to remove; negative counts from the end
countRequired. How many items to remove; 0 or less removes nothing
listOptional. The array to copy; omit it to get a reusable function

Return Value

Return ValueDescription
*A new array without the removed items

Ramda Examples

Example 1 — Official: Remove Three Items

The sample from the Ramda docs: start at index 2 and remove 3 items.

Ramda
console.log(R.remove(2, 3, [1, 2, 3, 4, 5, 6, 7, 8]));
// [1, 2, 6, 7, 8]
Try It Yourself

How It Works

  1. Start. Index 2 holds the value 3 (indexes begin at 0).
  2. Count. Three items from there are 3, 4, and 5.
  3. Copy. R.remove builds a new array without those three.
  4. Result. [1, 2] before the cut plus [6, 7, 8] after it.

Example 2 — Remove One Item, Keep the Original

Use a count of 1 to remove a single item, and confirm the input is unchanged.

Ramda
const colors = ['red', 'green', 'blue'];
const withoutGreen = R.remove(1, 1, colors);

console.log(withoutGreen);  // ['red', 'blue']
console.log(colors);        // ['red', 'green', 'blue']
Try It Yourself

How It Works

  1. Position. 'green' sits at index 1.
  2. Remove one. R.remove(1, 1, colors) leaves it out of a new array.
  3. New value. withoutGreen is ['red', 'blue'].
  4. No mutation. colors still has all three items, unlike native splice.

Example 3 — Count from the End

A negative start counts back from the end of the list.

Ramda
console.log(R.remove(-1, 1, ['x', 'y', 'z']));   // ['x', 'y']
console.log(R.remove(-2, 2, [1, 2, 3, 4, 5]));   // [1, 2, 3]
Try It Yourself

How It Works

  1. -1 is the last. In a 3-item list, -1 means index 3 - 1 = 2, the item 'z'.
  2. Remove it. A count of 1 drops just 'z'.
  3. -2 in 5 items. 5 - 2 = 3, so removal starts at value 4 and takes 4 and 5.
  4. Shortcut. For just the first or last items, R.drop and R.dropLast read even more clearly.

Example 4 — Remove a Record by Id (Safely)

Find the index first, and only remove when something was actually found.

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

const removeById = (id, list) => {
  const i = R.findIndex(R.propEq(id, 'id'), list);
  return i === -1 ? list : R.remove(i, 1, list);
};

console.log(R.pluck('name', removeById(2, users)));  // ['Ana', 'Cy']
console.log(R.pluck('name', removeById(9, users)));  // ['Ana', 'Ben', 'Cy']
Try It Yourself

How It Works

  1. Find. R.findIndex with R.propEq(2, 'id') returns 1, Ben’s position.
  2. Remove. R.remove(1, 1, list) returns a copy without Ben.
  3. Guard. For id 9, findIndex returns -1, so the list is returned as is.
  4. Why guard? Without it, R.remove(-1, 1, list) would silently delete the last user.

Example 5 — Drop a Header Row in a Pipeline

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

Ramda
const dropHeader = R.remove(0, 1);
const parseRows = R.pipe(dropHeader, R.map(R.split(',')));

console.log(parseRows(['name,age', 'Ana,31', 'Ben,25']));
// [['Ana', '31'], ['Ben', '25']]
Try It Yourself

How It Works

  1. Curry. R.remove(0, 1) has no list yet, so it returns a function that removes the first item.
  2. Drop. In the pipe, 'name,age' (index 0) is removed first.
  3. Split. R.map with R.split(',') turns each remaining row into an array.
  4. Reuse. dropHeader works on any list, so it can be shared across pipelines.

Browser & Runtime Support

R.remove() is plain JavaScript inside Ramda 0.2.2+: it copies the array and calls splice on the copy. Without Ramda, native Array.prototype.toSpliced() (ES2023) does the same, but only in Chrome 110+, Firefox 115+, Safari 16+, and Node 20+.

✓ Ramda 0.2.2+ · Any JS runtime

Ramda.js R.remove()

The UMD build (ramda.min.js) is compiled to ES5 syntax, so it runs in Chrome, Firefox, Safari, and Edge, including older versions without toSpliced. 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.remove() 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.remove(start, count, list) returns a new array with count items removed, beginning at index start. The official sample R.remove(2, 3, [1, 2, 3, 4, 5, 6, 7, 8]) returns [1, 2, 6, 7, 8].
No. It copies the list first and removes items from the copy, so the original array is unchanged. Native Array.prototype.splice, by contrast, changes the array in place.
Yes. A negative start counts back from the end, just like splice. R.remove(-1, 1, ['x', 'y', 'z']) removes the last item and returns ['x', 'y'].
Use R.without(['b'], list) to remove every matching value, or R.reject(pred, list) to remove by a rule. To remove just one match, find its index with R.indexOf or R.findIndex, check that it is not -1, then call R.remove(index, 1, list).
A count of 0 or a negative count removes nothing and returns an unchanged copy. A count larger than the remaining items simply removes everything from start to the end. No error is thrown.
No. R.remove has been a stable Ramda list function since v0.2.2. It is not deprecated, experimental, or non-standard.

Next: R.repeat()

Create a list that repeats one value n times.

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