zip-cycle
array →
zip-cycle(
array: array
) → array
Combines values from two arrays into two-element tuples until the longer array is exhausted, cycling each non-empty shorter array from its beginning. Returns an empty array when both inputs are empty and null when exactly one input is empty or either value cannot be evaluated as an array.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
array | array | Yes | Specifies the second array whose values form the second element of each tuple. |
Argument evaluation
array: Evaluated once in the enclosing context.
Behavior
Both inputs are materialized once. When both arrays are non-empty, the result has the cardinality of the longer array and indexes each input cyclically. Two empty inputs produce an empty array; exactly one empty input produces null because no value is available to cycle.
Examples
{1, 2, 3, 4} | zip-cycle({"a", "b"}) → {T(1, "a"), T(2, "b"), T(3, "a"), T(4, "b")}
Kind: Function
Scope: array/combination
Aliases: None