>>> 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 [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..] [] []
>>> 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 [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.
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')]