ListMap2FloatTest
`List.map2` and `List.map3` on `List Float` pass the Float elements unchanged to the mapping function, giving the expected sums and products. `Debug.log` prints a whole-number Float without a decimal point, as in `[11,22,33]`.
Results
elm-0.19.1
passran in 59 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. map2Add: [11,22,33] map2Mul: [3,5] map2Decimals: [4.5,6.5] map3: [111,222]
elm-0.19.2
passran in 75 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. map2Add: [11,22,33] map2Mul: [3,5] map2Decimals: [4.5,6.5] map3: [111,222]
elm-0.19.3
passran in 92 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. map2Add: [11,22,33] map2Mul: [3,5] map2Decimals: [4.5,6.5] map3: [111,222]
lamdera-1.5.0
passran in 58 msOutput
map2Add: [11,22,33] map2Mul: [3,5] map2Decimals: [4.5,6.5] map3: [111,222]
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/ListMap2FloatTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ListMap2FloatTest exposing (main)
{-| `List.map2` and `List.map3` on `List Float` pass the Float elements unchanged to
the mapping function, giving the expected sums and products.
`Debug.log` prints a whole-number Float without a decimal point, as in
`[11,22,33]`.
-}
-- CHECK: map2Add: [11,22,33]
-- CHECK: map2Mul: [3,5]
-- CHECK: map2Decimals: [4.5,6.5]
-- CHECK: map3: [111,222]
import Html exposing (text)
main =
let
_ = Debug.log "map2Add" (List.map2 (+) [1.0, 2.0, 3.0] [10.0, 20.0, 30.0])
_ = Debug.log "map2Mul" (List.map2 (*) [1.5, 2.5] [2.0, 2.0])
_ = Debug.log "map2Decimals" (List.map2 (+) [1.5, 2.5] [3.0, 4.0])
_ = Debug.log "map3" (List.map3 (\a b c -> a + b + c) [1.0, 2.0] [10.0, 20.0] [100.0, 200.0])
in
text "done"