Top index Wirbel home

::zip

zip(list(A) a, list(B) b) - convert two lists into one list of pairs
zip(list(A) a, list(B) b, list(C) c) - convert three lists into one list of triples

zip(list(A) a, list(B) b) takes two lists a and b and returns a new list of pairs. Each of those pairs combines one element of the a with the corresponding element of list b. The lists can have differnt types. If a and b have different length than the result list is truncated to the length of the shorter of both. The rest is silently dropped.

zip(list(A) a, list(B) b, list(C) c) does the same as zip(a,b) but combines three lists into one new list of triples, each of which contains one element of each list. The length of the resulting list is the length of the shortest lists of a, b and c.

Examples

 zip([1,2,3], ['a','b','c','d']) == [(1,'a'), (2,'b'), (3,'c')]