Skip to content

Main content

List: List Single Element Rank Shift Tool

Map one element index through a single remove-and-reinsert move to a final destination index, preserving all other element order.

Loading tool…

Description

Map movedFrom to movedTo.

An index map tracks where one item lands after a structural list operation. Zero-based element positions differ from boundary cursors, and missing destinations need a sentinel.

Map movedFrom to movedTo.

When to use this tool

Use List: List Single Element Rank Shift when you need one item's position under an explicit list transformation.

How to use the tool and how it works

  1. Enter index, movedFrom, movedTo, length. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Map movedFrom to movedTo. When moving forward, shift intervening items left one; when moving backward, shift intervening items right one; retain other positions.1

Input fieldMeaning and unitsAccepted input
indexIndexRequired. Safe integer.
movedFromMoved FromRequired. Safe integer.
movedToMoved ToRequired. Safe integer.
lengthLengthRequired. Safe integer.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.mappedIndexZero-based destination of the selected element.Calculated result member: number.
json
{
  "input": {
    "index": 3,
    "movedFrom": 1,
    "movedTo": 4,
    "length": 5
  },
  "output": {
    "result": {
      "mappedIndex": 2
    }
  }
}

Limitations and assumptions

  • This maps one zero-based destination for a remove-and-insert move without changing actual list data.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Apply the operation to a small representative list when checking a consuming language's indexing and slicing semantics.

References

  1. Calculation and input contract: list/list-single-element-rank-shift — tool.io

Similar or alternative tools