Skip to content

@lang:unzip

Transpose an array of pairs into two separate arrays.

On-chain (@lang:unzip!): Omitting lane returns both typed lanes. An explicit lane selects 0 or 1; keys and values select the corresponding lane.

Returns: array

@lang:unzip(pairs lane?)
NameTypeDescription
pairsarrayArray of [a, b] pairs
[lane]numberWhich lane to keep: 0 (first of each pair) or 1 (second)
  • @zip — combine two arrays into pairs
  • @keys, the named form of lane 0 over a record
  • @values, the named form of lane 1 over a record

Transpose an array of pairs into both lanes when lane is omitted. Pass 0 or 1 to select one lane. Runtime results retain each lane’s type; when both lanes have different types, the ABI result is a tuple of arrays.