Reverse Index Mapper
Map an index through reversal without reversing or copying list values.
Description
Map an index through reversal without reversing or copying list values.
Reversing a list maps its first position to the last and vice versa. A direct index formula avoids constructing the reversed values.
When to use this tool
Map an index through reversal without reversing or copying list values.
- Prepare the supplied index, length 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
- Enter index, length. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.reversedIndex. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Validate positive length and a zero-based index within it, then return length-1-index.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| index | index. | Integer from 0 to length - 1 inclusive |
| length | length. | Integer from 1 to 1e9 inclusive |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.reversedIndex | The reversed index value under the stated formula or text convention. |
{
"input": {
"index": 1,
"length": 5
},
"output": {
"result": {
"reversedIndex": 3
}
}
} Limitations and assumptions
- This is an index mapping only. It does not reverse text characters, nested rows or a supplied list, and an empty list has no valid index to map.
- 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
Similar or alternative tools
- reverse
Reverse a string list without modifying the input.
- Rotation Index Mapper
Map original position through a signed right rotation, distinct from copying rotated values.