FromArrayFloatListMapTest
Floating-point arithmetic in `List.map` works on a `List Float` taken out of an `Array` with `Array.toList`. `[1.5, 2.5]` goes through `Array.fromList` and `Array.toList`, and adding 0.5 to each element gives `[2.0, 3.0]`.
Results
elm-0.19.1
passran in 84 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. result: [2,3] match: True
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. result: [2,3] match: True
elm-0.19.3
passran in 56 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. result: [2,3] match: True
lamdera-1.5.0
passran in 52 msOutput
result: [2,3] match: True
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/FromArrayFloatListMapTest] in its title.
Source
The -- CHECK: lines give the expected output.
module FromArrayFloatListMapTest exposing (main)
{-| Floating-point arithmetic in `List.map` works on a `List Float` taken out of an `Array` with `Array.toList`.
`[1.5, 2.5]` goes through `Array.fromList` and `Array.toList`, and adding 0.5 to each element gives `[2.0, 3.0]`.
-}
-- CHECK: result: [2,3]
-- CHECK: match: True
import Array
import Html exposing (text)
main =
let
arr = Array.fromList [1.5, 2.5]
result = List.map ((+) 0.5) (Array.toList arr)
_ = Debug.log "result" result
_ = Debug.log "match" (result == [2.0, 3.0])
in
text "done"