Description
Compare equal-length encoded sequences without expansion, reporting the first exact unequal-value offset independent of encoded boundary placement.
Run-length records represent repeated observations without expanding them. Each record pairs a literal string value with a positive exact integer length; neighboring equal values can be valid but noncompact. Expanded offsets count observations rather than run records, and half-open ranges include their start while excluding their end.
Compare equal-length encoded sequences without expansion, reporting the first exact unequal-value offset independent of encoded boundary placement.
When to use this tool
Use this tool to compare equal-length encoded sequences without expansion, reporting the first exact unequal-value offset independent of encoded boundary placement.
How to use the tool and how it works
- Enter leftJson, rightJson using the definitions below. Serialize JSON text fields in the decoded shape shown below.
- Run the operation. Resolve input-format errors before interpreting an output.
- Read result.equal, result.witness, using the stated boundary, ordering, sign and absence conventions.
Require equal expanded totals, align both run streams at every boundary and find the first span with different values. Return equal and either null or {offset,left,right} for the earliest difference.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| leftJson | Left run sequence using string values and positive decimal-string lengths. | Text, at most 8,192 UTF-16 code units; narrower grammar/range rules also apply. |
| rightJson | Right run sequence in the same format; pair-alignment/equality operations require equal expanded totals. | Text, at most 8,192 UTF-16 code units; narrower grammar/range rules also apply. |
These decoded structures show the examples inside JSON text fields. Supply their serialized JSON strings as input.
{
"leftJson": [
{
"value": "a",
"length": "3"
},
{
"value": "a",
"length": "2"
},
{
"value": "b",
"length": "4"
}
],
"rightJson": [
{
"value": "a",
"length": "4"
},
{
"value": "c",
"length": "5"
}
]
} | Output field | Interpretation |
|---|---|
| result | Object containing the fields below. |
| result.equal | Whether equal-total sequences have the same value at every expanded position. |
| result.witness | Earliest differing expanded offset and left/right values, or null if equal. |
{
"input": {
"leftJson": "[{\"value\": \"a\", \"length\": \"3\"}, {\"value\": \"a\", \"length\": \"2\"}, {\"value\": \"b\", \"length\": \"4\"}]",
"rightJson": "[{\"value\":\"a\",\"length\":\"4\"},{\"value\":\"c\",\"length\":\"5\"}]"
},
"output": {
"result": {
"equal": false,
"witness": {
"offset": "4",
"left": "a",
"right": "c"
}
}
}
} Limitations and assumptions
- Unequal total lengths cause an input error rather than equal=false; layouts with different run boundaries can still represent equal sequences.
- Run records contain string value and positive length as exact decimal integer text. Lengths and offset inputs support up to 256 decimal digits before operation-specific checks; results use decimal text and do not expand the repeated observations.
- Every declared outer field is required and unknown outer fields are rejected. Strings and JSON text have size limits, lists are bounded to 128 entries, and JSON nesting/node counts are bounded. Tighter operation-specific bounds stated above take precedence.
- Ordinary numeric outputs must be finite and within safe-integer magnitude. Exact large lengths/counts use decimal strings. Original record indexes and code-unit positions are zero-based; span ends are exclusive unless stated otherwise.
Alternative or Complementary methods
Use compaction for a canonical adjacent-run layout and boundary-aware operations when provenance matters. Retain exact decimal lengths rather than converting long totals to floating-point numbers.
References
Similar or alternative tools
- Run Length Record Adjacent Compaction
Run lengths are positive exact integer decimal strings with literal string values, never expanded; compact adjacent exactly equal values by summing exact lengths, not global deduplication.
- Run Length Record Aligned Pair Spans
Run lengths are positive exact integer decimal strings with literal string values, never expanded; align two equal-total encoded sequences at every source boundary, with paired values and exact logical spans.