ListMap2345Test
`List.map2` and `List.map3` combine lists element by element. `List.map2 (+)` adds two three-element lists, and `List.map3` sums three. `List.map4` and `List.map5` are not tested, despite the module name.
Results
elm-0.19.1
passran in 53 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. map2_result: [5,7,9] map3_result: [12,15,18]
elm-0.19.2
passran in 71 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. map2_result: [5,7,9] map3_result: [12,15,18]
elm-0.19.3
passran in 50 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. map2_result: [5,7,9] map3_result: [12,15,18]
lamdera-1.5.0
passran in 53 msOutput
map2_result: [5,7,9] map3_result: [12,15,18]
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/ListMap2345Test] in its title.
Source
The -- CHECK: lines give the expected output.
module ListMap2345Test exposing (main)
{-| `List.map2` and `List.map3` combine lists element by element.
`List.map2 (+)` adds two three-element lists, and `List.map3` sums three. `List.map4` and `List.map5` are not tested, despite the module name.
-}
-- CHECK: map2_result: [5,7,9]
-- CHECK: map3_result: [12,15,18]
import Html exposing (text)
main =
let
_ = Debug.log "map2_result" (List.map2 (+) [1, 2, 3] [4, 5, 6])
_ = Debug.log "map3_result" (List.map3 (\a b c -> a + b + c) [1, 2, 3] [4, 5, 6] [7, 8, 9])
in
text "done"