26 lines
552 B
Plaintext
26 lines
552 B
Plaintext
// First, we'll define a general-purpose zip() to zip
|
|
any
|
|
// number of lists together.
|
|
function zip(...)
|
|
{
|
|
variable result;
|
|
variable list_num := 0;
|
|
iterate(arg; arguments)
|
|
{
|
|
variable elem_num := 0;
|
|
iterate (x; arg)
|
|
{
|
|
result[elem_num][list_num] := x;
|
|
++elem_num;
|
|
};
|
|
++list_num;
|
|
};
|
|
return result;
|
|
};
|
|
|
|
immutable a := ["a", "b", "c"],
|
|
b := ["A", "B", "C"],
|
|
c := [1, 2, 3];
|
|
iterate (x; zip(a, b, c))
|
|
print(x[0], x[1], x[2], "\n");;
|