Description
Validate all indices within positive length.
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.
Validate all indices within positive length.
When to use this tool
Use List: List Swap Index Map when you need one item's position under an explicit list transformation.
How to use the tool and how it works
- Enter index, first, second, length. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Validate all indices within positive length. Map first to second and second to first; leave every other index unchanged.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| index | Index | Required. Safe integer. |
| first | First | Required. Safe integer. |
| second | Second | Required. Safe integer. |
| length | Length | Required. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Result | Required. Object. |
| result.mappedIndex | Zero-based destination of the selected element. | Calculated result member: number. |
{
"input": {
"index": 1,
"first": 1,
"second": 3,
"length": 4
},
"output": {
"result": {
"mappedIndex": 3
}
}
} Limitations and assumptions
- Equal swap positions are a no-op; this maps an index without mutating list contents.
- 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
Similar or alternative tools
- List: List Single Element Rank Shift
Map movedFrom to movedTo.
- List Stable Partition One Index Destination
Select the item's Boolean group, count same-group entries before it, and add the size of the other group only when its group is ordered second by trueFirst.