Where is List.zip in Elm?
unzip
is a function available as part of the list package.
It's defined as:
Decompose a list of tuples into a tuple of lists.
But there is no corresponding zip
function to compose a tuple of lists into a list of tuples. If you just want a list to be zipped with it's index, then you can use List.indexedMap
.
And you could substitute (\x y -> (x, y))
with Tuple.pair
which does the same thing.
And if you don't care about indexes but instead have two lists, you can zip those two lists together with List.map2
.
Happy Zipping!
Tweet