Skip to content

Main content

List Two Slice Concatenation Index Tool

Calculate list two slice concatenation index from explicit caller-supplied inputs.

Loading tool…

Description

Validate selected within firstLength + secondLength.

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 selected within firstLength + secondLength.

When to use this tool

Use List Two Slice Concatenation Index when you need one item's position under an explicit list transformation.

How to use the tool and how it works

  1. Enter firstLength, secondLength, selected. 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 source, localIndex. Use the output convention below.

Validate selected within firstLength + secondLength. Return source zero and selected when it falls in the first slice, otherwise source one and selected - firstLength.1

Input fieldMeaning and unitsAccepted input
firstLengthFirst LengthRequired. Safe integer; minimum 0.
secondLengthSecond LengthRequired. Safe integer; minimum 0.
selectedSelectedRequired. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
sourceSource identifier or source selector, interpreted under the calculation above.Required. Safe integer.
localIndexLocal IndexRequired. Safe integer.
json
{
  "input": {
    "firstLength": 3,
    "secondLength": 4,
    "selected": 5
  },
  "output": {
    "source": 1,
    "localIndex": 2
  }
}

Limitations and assumptions

  • Both source lengths may be zero individually, but a selected item requires a nonempty combined list; contents are not concatenated.
  • 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-two-slice-concatenation-index — tool.io

Similar or alternative tools