Skip to content

Main content

List Two Index Adjacency Label

Compare two explicit zero-based list indices for immediate adjacency and direction within supplied bounds.

Loading tool…

Description

Label order and adjacency of two supplied list indices.

List operations require explicit linear indices, mask alignment, chunk boundaries and empty-list policy. A selected-count change does not identify which positions changed, and an exact-multiple remainder may produce an optional empty chunk. These helpers use supplied lengths or masks rather than inspecting or modifying a list of values.

Label order and adjacency of two supplied list indices.

When to use this tool

Use List Two Index Adjacency Label when you already have firstIndex, secondIndex, listLength and need to label order and adjacency of two supplied list indices.

How to use the tool and how it works

  1. Enter firstIndex, secondIndex, listLength. 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 adjacent, order. Inspect adjacent before interpreting the associated values.

Require safe whole listLength>=1 and each index in [0,length-1]; adjacent means abs(second-first)=1 and order is forward, backward or same.1

Input fieldMeaning and unitsAccepted input
firstIndexFirst IndexRequired. Safe integer; minimum 0.
secondIndexSecond IndexRequired. Safe integer; minimum 0.
listLengthList LengthRequired. Safe integer; minimum 1.
Output fieldInterpretationReturned shape
adjacentAdjacentRequired. Boolean.
orderOrderRequired. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "firstIndex": 2,
    "secondIndex": 3,
    "listLength": 8
  },
  "output": {
    "adjacent": true,
    "order": "forward"
  }
}

Limitations and assumptions

  • This is linear adjacency without wraparound; no actual list contents or element identity are inspected.
  • 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

Operate on the actual list when contents, identity or reordered values matter. State the index origin and empty-chunk policy in the full processing workflow; local counts and masks do not establish a valid transformation of underlying data.

References

  1. Calculation and input contract: list/list-two-index-adjacency-label — tool.io

Similar or alternative tools