ListConcatMapTest
`List.concatMap` concatenates the lists its function returns for each element, and gives an empty list for an empty input. The function maps each element `x` to `[x, x]`, so `[1,2,3]` becomes `[1,1,2,2,3,3]`.
Results
elm-0.19.1
passran in 81 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. concatMap1: [1,1,2,2,3,3] concatMap_empty: []
elm-0.19.2
passran in 65 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. concatMap1: [1,1,2,2,3,3] concatMap_empty: []
elm-0.19.3
passran in 49 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. concatMap1: [1,1,2,2,3,3] concatMap_empty: []
lamdera-1.5.0
passran in 55 msOutput
concatMap1: [1,1,2,2,3,3] concatMap_empty: []
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/ListConcatMapTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ListConcatMapTest exposing (main)
{-| `List.concatMap` concatenates the lists its function returns for each element, and gives an empty list for an empty input.
The function maps each element `x` to `[x, x]`, so `[1,2,3]` becomes `[1,1,2,2,3,3]`.
-}
-- CHECK: concatMap1: [1,1,2,2,3,3]
-- CHECK: concatMap_empty: []
import Html exposing (text)
main =
let
_ = Debug.log "concatMap1" (List.concatMap (\x -> [x, x]) [1, 2, 3])
_ = Debug.log "concatMap_empty" (List.concatMap (\x -> [x, x]) [])
in
text "done"