Zipping version of List andMap and mapN functions.
This module exists mainly to illustrate the difference between the
List.Cartesian functions and the "common" ones from elm/core and
elm-community/list-extra.
The map2 functions in this module are aliases of the functions found in List:
List.Zip.map2 = List.map2 and so on.
Same as List.map2.
Note that the zipping behaviour will drop items if your lists aren't of the same length.
List.Zip.map2 (*) [ 10, 100 ] [ 1, 2, 3 ]
--> [ 10, 200 ]Same as List.map3.
Note that the zipping behaviour will drop items if your lists aren't of the same length.
Same as List.map4.
Note that the zipping behaviour will drop items if your lists aren't of the same length.
Same as List.map5.
Note that the zipping behaviour will drop items if your lists aren't of the same length.
In case you're looking for map6 etc., you can use this andMap pattern to map
as many lists you want:
List.repeat listLength fn
|> List.Zip.andMap list1
|> List.Zip.andMap list2
|> List.Zip.andMap list3
|> List.Zip.andMap list4
|> List.Zip.andMap list5
|> List.Zip.andMap list6
|> ...The gotcha is in that you need to provide the function repeated: [fn] |> ...
would not work correctly, as it would return a list with at most 1 item inside.
Same as
List.Extra.andMap.A building block for arbitrary
mapNfunctions, but beware: there is a gotcha. Seemap5for more info.Note that the zipping behaviour will drop items if your lists aren't of the same length.