Ramda.js R.move() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
List

Definition

A list function that moves one item to a new position. R.move(from, to, list) takes the item at from, places it at to, and returns a new list — the original stays untouched. Perfect for drag-and-drop style reordering.

Status: stable since Ramda v0.27.1 — not deprecated, experimental, or non-standard.

Syntax

Call R.move. Start with this line.

Ramda
R.move(from, to, list)
CallWhat it does
R.move(from, to, list)Primary signature.
R.move(...)Call the list helper.

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

Library declarations
Ramda
R.move(from, to, list)

Parameters

ParameterDescription
fromRequired. Index of the item to move (negative counts from the end)
toRequired. Index the item should have in the result
listRequired. The array to reorder (not changed)

Return Value

Return ValueDescription
*A new array with the item moved

Ramda Examples

Example 1 — Official: Move "a" to Index 2

Take the first item out and place it third.

Ramda
const letters = ["a", "b", "c", "d", "e", "f"];

console.log(R.move(0, 2, letters));
// → ["b", "c", "a", "d", "e", "f"]
Try It Yourself

How It Works

  1. Take. Index 0 holds "a"; it is removed.
  2. Shift. "b" and "c" slide one place left.
  3. Place. "a" is inserted at index 2 of the result.

Example 2 — Official: Negative Index

-1 means the last item — here it moves to the front.

Ramda
const letters = ["a", "b", "c", "d", "e", "f"];

console.log(R.move(-1, 0, letters));
// → ["f", "a", "b", "c", "d", "e"]
Try It Yourself

How It Works

  1. Convert. -1 becomes 6 - 1 = 5, the last index.
  2. Take. "f" is removed from the end.
  3. Place. It is inserted at index 0; everything else shifts right.

Example 3 — Reorder Without Mutation

Move a task to the top of a to-do list. The original array is left alone.

Ramda
const tasks = ["Wash", "Cook", "Shop"];
const reordered = R.move(2, 0, tasks);

console.log(reordered);   // → ["Shop", "Wash", "Cook"]
console.log(tasks);       // → ["Wash", "Cook", "Shop"]
Try It Yourself

How It Works

  1. Move. "Shop" (index 2) goes to index 0.
  2. New array. reordered is a fresh list.
  3. Safe. tasks is unchanged — unlike native splice, which edits in place.

Example 4 — Out-of-Range Index

A bad index doesn’t throw. You simply get the same list back.

Ramda
const nums = [1, 2, 3];
const result = R.move(0, 10, nums);

console.log(result);           // → [1, 2, 3]
console.log(result === nums);  // → true
Try It Yourself

How It Works

  1. Check. Valid indexes are 0 to 2; 10 is outside.
  2. Bail out. R.move returns the input list as-is.
  3. Same array. result === nums is true — nothing was copied or changed.

Example 5 — A Reusable “Last to Front” Function

R.move is curried, so give it the indexes now and the list later.

Ramda
const lastToFront = R.move(-1, 0);

console.log(R.map(lastToFront, [[1, 2, 3], ["x", "y"]]));
// → [[3, 1, 2], ["y", "x"]]
Try It Yourself

How It Works

  1. Partial call. R.move(-1, 0) returns a function still waiting for a list.
  2. Map. R.map applies it to each inner array.
  3. Per list. -1 is resolved for each list’s own length, so both last items move to the front.

Browser & Runtime Support

R.move was added in Ramda v0.27.1. Ramda’s browser build is plain ES5, so it runs in any modern browser and in Node.js / Bun / Deno with npm install ramda.

✓ Stable · Ramda 0.27.1+

R.move()

Built on plain slice, splice, and concat, so no special browser API is needed. Older Ramda versions don’t have it — check your version before upgrading code.

100% With Ramda 0.27.1+
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.move Ramda 0.27.1+

Bottom line: Safe for production with Ramda 0.27.1 or newer. The labs on this page use [email protected].

Frequently Asked Questions

R.move(from, to, list) takes the item at index from and places it at index to, returning a new list. The original list is not changed. Docs sample: R.move(0, 2, ['a', 'b', 'c', 'd', 'e', 'f']) //=> ['b', 'c', 'a', 'd', 'e', 'f'].
Yes. Negative numbers count from the end, so -1 is the last item. R.move(-1, 0, ['a', 'b', 'c', 'd', 'e', 'f']) moves 'f' to the front.
R.move returns the original list unchanged — the very same array, not a copy — and does not throw. For example, R.move(0, 10, [1, 2, 3]) is [1, 2, 3].
No. It works on a copy, unlike native Array.prototype.splice. Items themselves are not cloned, so objects inside the list are shared with the original.

Next: R.none()

Learn how to check that no item in a list passes a test.

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