Skip to content

Main content

List: List Single Splice Length Delta Tool

Compute one splice length delta with nonnegative start and deletion clipped at the list end; no mutation of list contents.

Loading tool…

Description

Clamp deleteCount to the available suffix length.

A splice replaces part of a list and changes later positions. Cursor affinity defines which side of inserted content a boundary follows when the splice covers it.

Clamp deleteCount to the available suffix length.

When to use this tool

Use List: List Single Splice Length Delta when you need a splice length, gap-fill, or cursor-mapping calculation.

How to use the tool and how it works

  1. Enter length, start, deleteCount, insertCount. 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 result. Expand result to inspect the returned fields.

Clamp deleteCount to the available suffix length. Return actualDeleteCount, insertCount minus actualDeleteCount as lengthDelta, and the updated length.1

Input fieldMeaning and unitsAccepted input
lengthLengthRequired. Safe integer.
startStartRequired. Safe integer.
deleteCountDelete CountRequired. Safe integer.
insertCountInsert CountRequired. Safe integer.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.newLengthNew LengthCalculated result member: number.
result.lengthDeltaLength DeltaCalculated result member: number.
result.actualDeleteCountActual Delete CountCalculated result member: number.
json
{
  "input": {
    "length": 5,
    "start": 4,
    "deleteCount": 3,
    "insertCount": 2
  },
  "output": {
    "result": {
      "newLength": 6,
      "lengthDelta": 1,
      "actualDeleteCount": 1
    }
  }
}

Limitations and assumptions

  • This models the supplied nonnegative start only; negative-index language semantics and list contents are not handled.
  • 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

Check the actual collection API's deletion clamping and cursor semantics before applying an edit.

References

  1. Calculation and input contract: list/list-single-splice-length-delta — tool.io

Similar or alternative tools