This function emulates Python's zip function. It expects a variable number of arguments. If a single vector/list x is passed the return value is a list of lists where each sub-list contains the components “key” and “value”. If x is named the key is the name, otherwise it is the element number. The value field unsuprisingly contains the corresponding value.

zip(...)

Arguments

...

[Lists/vectors]
A variable number of lists or vectors of the same size.

Value

A list of lists.

Examples

x = list("a" = 1, "b" = 2, "c" = 3) for (el in zip(x)) { catf("Key: '%s', Value: %i\n", el$key, el$value) }
#> Key: 'a', Value: 1 #> Key: 'b', Value: 2 #> Key: 'c', Value: 3
z = zip(x, x)