Elm Exactly
Results / elm-core /

TestIndexedMap

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Array.indexedMap` passes each element's index, counting from 0, along with
the element: pairing them on `[10, 20, 30]` gives `[(0,10),(1,20),(2,30)]`.

Results

elm-0.19.1

passran in 59 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
indexedMap1: [(0,10),(1,20),(2,30)]

elm-0.19.2

passran in 62 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
indexedMap1: [(0,10),(1,20),(2,30)]

elm-0.19.3

passran in 52 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
indexedMap1: [(0,10),(1,20),(2,30)]

lamdera-1.5.0

passran in 55 ms
Output
indexedMap1: [(0,10),(1,20),(2,30)]

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module TestIndexedMap exposing (main)
{-| `Array.indexedMap` passes each element's index, counting from 0, along with
the element: pairing them on `[10, 20, 30]` gives `[(0,10),(1,20),(2,30)]`.
-}
-- CHECK: indexedMap1: [(0,10),(1,20),(2,30)]
import Array
import Html exposing (text)
main =
let
arr = Array.fromList [10, 20, 30]
_ = Debug.log "indexedMap1" (Array.toList (Array.indexedMap (\i v -> (i, v)) arr))
in
text "done"