Rotation Index Mapper

Map original position through a signed right rotation, distinct from copying rotated values.

Description

Map original position through a signed right rotation, distinct from copying rotated values.

Rotating a list changes where each original index lands while preserving cyclic order. Positive right rotation and negative left rotation can share one modular formula.

When to use this tool

Map original position through a signed right rotation, distinct from copying rotated values.

  • Prepare the supplied index, length, rightRotation fields for this operation.
  • Compare the complete example with the representation used by your own input before carrying the result into another step.

How to use the tool and how it works

  1. Enter index, length, rightRotation. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.rotatedIndex. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Validate index within positive length and bounded integer rightRotation. Return the nonnegative remainder of index+rightRotation modulo length.1

Input fieldMeaning and representationAccepted input
indexindex.Integer from 0 to length - 1 inclusive
lengthlength.Integer from 1 to 1e9 inclusive
rightRotationright rotation.Integer from -1e9 to 1e9 inclusive
Output fieldInterpretation
resultObject containing the named outputs below.
result.rotatedIndexThe rotated index value under the stated formula or text convention.
json
{
  "input": {
    "index": 4,
    "length": 5,
    "rightRotation": 2
  },
  "output": {
    "result": {
      "rotatedIndex": 1
    }
  }
}

Limitations and assumptions

  • This maps an original index to its destination; it does not identify the original entry at a chosen destination. Values are not moved and rotations may exceed the length.
  • Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
  • Ordinary string lists have at most 128 entries of at most 128 code units each; numeric lists and matrices have separate bounded size checks. Nonfinite results and excessively large serialized outputs are rejected.
  • Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.

Alternative or Complementary methods

Use explicit source-index maps when rearranging data or planning missing-value fills. Keep row-major coordinates, cyclic indexes and one-based occurrence numbers distinct, and inspect null donor positions before copying values.

References

  1. Tool behavior and example: Rotation Index Mapper — tool.io

Similar or alternative tools

  • Reverse Index Mapper

    Map an index through reversal without reversing or copying list values.

  • Adjacent Change Indexes

    Return indexes whose value differs from the previous supplied string, not CSS change hints or a value transform.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies