zip

zip takes two lists and returns a list of corresponding pairs. zip is right-lazy:
>>> zip [] undefined
[]

>>> zip undefined []
*** Exception: Prelude.undefined
...
zip is capable of list fusion, but it is restricted to its first list argument and its resulting list.

Examples

>>> zip [1, 2, 3] ['a', 'b', 'c']
[(1,'a'),(2,'b'),(3,'c')]
If one input list is shorter than the other, excess elements of the longer list are discarded, even if one of the lists is infinite:
>>> zip [1] ['a', 'b']
[(1,'a')]
>>> zip [1, 2] ['a']
[(1,'a')]
>>> zip [] [1..]
[]
>>> zip [1..] []
[]
The zip function takes two streams and returns a stream of corresponding pairs.
O(n) zip takes two ByteStrings and returns a list of corresponding pairs of bytes. If one input ByteString is short, excess elements of the longer ByteString are discarded. This is equivalent to a pair of unpack operations.
O(n) zip takes two ByteStrings and returns a list of corresponding pairs of Chars. If one input ByteString is short, excess elements of the longer ByteString are discarded. This is equivalent to a pair of unpack operations, and so space usage may be large for multi-megabyte ByteStrings
O(n) zip takes two Texts and returns a list of corresponding pairs of bytes. If one input Text is short, excess elements of the longer Text are discarded. This is equivalent to a pair of unpack operations.
zip takes two sequences and returns a sequence of corresponding pairs. If one input is short, excess elements are discarded from the right end of the longer sequence.
zip takes two lists and returns a list of corresponding pairs.
>>> zip [1, 2] ['a', 'b']
[(1,'a'),(2,'b')]
If one input list is shorter than the other, excess elements of the longer list are discarded, even if one of the lists is infinite:
>>> zip [1] ['a', 'b']
[(1,'a')]

>>> zip [1, 2] ['a']
[(1,'a')]

>>> zip [] [1..]
[]

>>> zip [1..] []
[]
zip is right-lazy:
>>> zip [] undefined
[]

>>> zip undefined []
*** Exception: Prelude.undefined
...
zip is capable of list fusion, but it is restricted to its first list argument and its resulting list.
Zip two Producers
Zip for strict pairs (defined with zipWith).
Combines two input streams. Continues yielding elements from both input streams until one of them finishes.
Zip two Streams
zip takes two lists and returns a list of corresponding pairs.
zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]
If one input list is short, excess elements of the longer list are discarded:
zip [1] ['a', 'b'] = [(1, 'a')]
zip [1, 2] ['a'] = [(1, 'a')]
zip is right-lazy:
zip [] _|_ = []
zip _|_ [] = _|_
zip is capable of list fusion, but it is restricted to its first list argument and its resulting list.
O(min(m,n)) Zip two vectors
Elementwise pairing of array elements.
O(1) Zip 2 vectors
O(1). Zip some unboxed arrays. The shapes must be identical else error.
Takes two lists and returns a list of corresponding pairs.
O(n) zip takes two JSStrings and returns a list of corresponding pairs of bytes. If one input JSString is short, excess elements of the longer JSString are discarded. This is equivalent to a pair of unpack operations.
Combines two structures by taking the intersection of their shapes and using pair to hold the elements.
O(n) zip takes two Vectors and returns a list of corresponding pairs of elements. If one input Vector is short, excess elements of the longer Vector are discarded. This is equivalent to a pair of unpack operations.
zip takes two arrays and returns an array of corresponding pairs.
zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]
If one input array is shorter than the other, excess elements of the longer array are discarded:
zip [1] ['a', 'b'] = [(1, 'a')]
zip [1, 2] ['a'] = [(1, 'a')]
O(n) Zip two vectors of the same length
O(n) Zip two vectors of the same length.