Description
Select complete runs by an explicit allowed-value bank, then compact adjacent remaining equal runs; logical positions close after removal.
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.
Select complete runs by an explicit allowed-value bank, then compact adjacent remaining equal runs; logical positions close after removal.
When to use this tool
Use this tool to select complete runs by an explicit allowed-value bank, then compact adjacent remaining equal runs; logical positions close after removal.
How to use the tool and how it works
- Enter runsJson, values 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.runs, using the stated boundary, ordering, sign and absence conventions.
Keep source runs whose values occur in the supplied selector bank, then merge newly adjacent equal values by adding lengths.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| runsJson | JSON array of {value,length} records: literal string value and positive exact decimal-string length. | Text, at most 8,192 UTF-16 code units; narrower grammar/range rules also apply. |
| values | Literal value strings to retain from the source sequence. | Dense list of at most 128 literal strings, each at most 8,192 UTF-16 units. |
These decoded structures show the examples inside JSON text fields. Supply their serialized JSON strings as input.
{
"runsJson": [
{
"value": "a",
"length": "3"
},
{
"value": "a",
"length": "2"
},
{
"value": "b",
"length": "4"
}
]
} | Output field | Interpretation |
|---|---|
| result | Object containing the fields below. |
| result.runs | Resulting {value,length} records, with exact positive decimal lengths and the stated compaction policy. |
{
"input": {
"runsJson": "[{\"value\": \"a\", \"length\": \"3\"}, {\"value\": \"a\", \"length\": \"2\"}, {\"value\": \"b\", \"length\": \"4\"}]",
"values": [
"a"
]
},
"output": {
"result": {
"runs": [
{
"value": "a",
"length": "5"
}
]
}
}
} Limitations and assumptions
- Removing intervening runs changes expanded positions; the result is a filtered sequence, not a mask on original offsets.
- 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 Value First Offset
Run lengths are positive exact integer decimal strings with literal string values, never expanded; find the first logical offset of a literal value, retaining null when absent rather than using a sentinel position.
- Run Length Record Value Map
Run lengths are positive exact integer decimal strings with literal string values, never expanded; map explicit literal values by a unique-key caller map and compact newly adjacent equal runs; mapping may deliberately merge values.