Description
Subtract shift from the valid selected destination and reduce modulo positive length for source.
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.
Subtract shift from the valid selected destination and reduce modulo positive length for source.
When to use this tool
Use List Rotation Selected Index Preimage when you need one item's position under an explicit list transformation.
How to use the tool and how it works
- Enter length, shift, selected. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read source. Use the output convention below.
Subtract shift from the valid selected destination and reduce modulo positive length for source.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| length | Length, count, or code length under the stated domain and unit convention. | Required. Safe integer; minimum 1. |
| shift | Shift | Required. Safe integer. |
| selected | Selected | Required. Safe integer; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| source | Source label or index interpreted under the specific calculation above. | Required. Safe integer. |
{
"input": {
"length": 5,
"shift": 2,
"selected": 0
},
"output": {
"source": 3
}
} Limitations and assumptions
- This is a rotation preimage, not the forward destination; list values are not moved.
- 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 Offset Wrap Index
Add signed index and offset using exact integers, then use floor division by positive length to return a nonnegative wrappedIndex and signed turns.
- Cyclic List Phase Remainder
Subtract origin from index using exact integers and reduce modulo positive length into phase in [0, length).