Skip to content

Main content

List Circular Slice Length Tool

Count a forward circular half-open index span with explicit equal-endpoint semantics.

Loading tool…

Description

Return the forward modular distance from start to end.

Half-open list ranges include their start and exclude their end. Empty and touching ranges can be disjoint even when their boundary coordinates coincide.

Return the forward modular distance from start to end.

When to use this tool

Use List Circular Slice Length when you need a precise range relationship for a list operation.

How to use the tool and how it works

  1. Enter length, start, end, fullWhenEqual. 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 sliceLength. Use the output convention below.

Return the forward modular distance from start to end. At equal endpoints choose positive length or zero according to fullWhenEqual.1

Input fieldMeaning and unitsAccepted input
lengthLength, count, or code length under the stated domain and unit convention.Required. Safe integer; minimum 1.
startStartRequired. Safe integer; minimum 0.
endEndRequired. Safe integer; minimum 0.
fullWhenEqualFull When EqualRequired. Boolean.
Output fieldInterpretationReturned shape
sliceLengthSlice LengthRequired. Safe integer.
json
{
  "input": {
    "length": 8,
    "start": 6,
    "end": 2,
    "fullWhenEqual": false
  },
  "output": {
    "sliceLength": 4
  }
}

Limitations and assumptions

  • Only one cycle is represented; endpoint equality alone cannot infer the intended traversal.
  • 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

Validate ranges against the actual list length and the operation's overlap policy before mutating data.

References

  1. Calculation and input contract: list/list-circular-slice-length — tool.io

Similar or alternative tools