Elm Exactly
Results / elm-core /

ArrayIndexedMapFloatAddIndexTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Array.indexedMap` over an `Array Float` passes each element's index, here added to the
element to turn `[ 10, 20, 30 ]` into `[ 10, 21, 32 ]`.

Results

elm-0.19.1

passran in 61 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
result: [10,21,32]
match: True

elm-0.19.2

passran in 60 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
result: [10,21,32]
match: True

elm-0.19.3

passran in 64 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
result: [10,21,32]
match: True

lamdera-1.5.0

passran in 57 ms
Output
result: [10,21,32]
match: True

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-core/ArrayIndexedMapFloatAddIndexTest] in its title.

Source

The -- CHECK: lines give the expected output.

module ArrayIndexedMapFloatAddIndexTest exposing (main)
{-| `Array.indexedMap` over an `Array Float` passes each element's index, here added to the
element to turn `[ 10, 20, 30 ]` into `[ 10, 21, 32 ]`.
-}
-- CHECK: result: [10,21,32]
-- CHECK: match: True
import Array
import Html exposing (text)
main =
let
arr =
Array.fromList [ 10.0, 20.0, 30.0 ]
result =
Array.toList (Array.indexedMap (\i x -> x + toFloat i) arr)
_ =
Debug.log "result" result
_ =
Debug.log "match" (result == [ 10.0, 21.0, 32.0 ])
in
text "done"