Indexed Interleave Tool

Interleave explicit lists with source-side and source-index provenance; retain unequal-length tails.

Description

Interleave explicit lists with source-side and source-index provenance; retain unequal-length tails.

Interleaving alternates corresponding entries from two lists. A source map makes the output reversible even when the lists have unequal lengths.

When to use this tool

Interleave explicit lists with source-side and source-index provenance; retain unequal-length tails.

  • Prepare the supplied left, right fields for this operation.
  • Compare the complete example with the representation used by your own input before carrying the result into another step.

How to use the tool and how it works

  1. Enter left, right. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.values, result.sources. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

At each index, append the left entry if present and then the right entry if present. Return combined values and aligned {side,index} records; continue with the remaining side when the other ends.1

Input fieldMeaning and representationAccepted input
leftleft.At most 128 strings, each at most 128 UTF-16 code units
rightright.At most 128 strings, each at most 128 UTF-16 code units
Output fieldInterpretation
resultObject containing the named outputs below.
result.valuesThe values list in the ordering and representation described above.
result.sourcesThe sources list in the ordering and representation described above.
json
{
  "input": {
    "left": [
      "a",
      "b"
    ],
    "right": [
      "x"
    ]
  },
  "output": {
    "result": {
      "values": [
        "a",
        "x",
        "b"
      ],
      "sources": [
        {
          "side": "left",
          "index": 0
        },
        {
          "side": "right",
          "index": 0
        },
        {
          "side": "left",
          "index": 1
        }
      ]
    }
  }
}

Limitations and assumptions

  • Inputs are not required to have equal length. The tool does not sort, deduplicate or insert placeholders for a missing side.
  • Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
  • Ordinary string lists have at most 128 entries of at most 128 code units each; numeric lists and matrices have separate bounded size checks. Nonfinite results and excessively large serialized outputs are rejected.
  • Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.

Alternative or Complementary methods

Use explicit source-index maps when rearranging data or planning missing-value fills. Keep row-major coordinates, cyclic indexes and one-based occurrence numbers distinct, and inspect null donor positions before copying values.

References

  1. Tool behavior and example: Indexed Interleave Tool — tool.io

Similar or alternative tools

  • Adjacent Change Indexes

    Return indexes whose value differs from the previous supplied string, not CSS change hints or a value transform.

  • Alternating Sign Run Segmenter

    Segment consecutive strictly alternating nonzero signs; zeros and equal adjacent signs break runs.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies