ListRepeatTest
`List.repeat n x` gives a list of `n` copies of `x`, and an empty list when `n` is 0. It is checked with an `Int` and with a `String`.
Results
elm-0.19.1
passran in 79 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. repeat1: [0,0,0] repeat_str: ["hi","hi"] repeat_zero: []
elm-0.19.2
passran in 50 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. repeat1: [0,0,0] repeat_str: ["hi","hi"] repeat_zero: []
elm-0.19.3
passran in 78 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. repeat1: [0,0,0] repeat_str: ["hi","hi"] repeat_zero: []
lamdera-1.5.0
passran in 40 msOutput
repeat1: [0,0,0] repeat_str: ["hi","hi"] repeat_zero: []
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/ListRepeatTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ListRepeatTest exposing (main)
{-| `List.repeat n x` gives a list of `n` copies of `x`, and an empty list when `n` is 0.
It is checked with an `Int` and with a `String`.
-}
-- CHECK: repeat1: [0,0,0]
-- CHECK: repeat_str: ["hi","hi"]
-- CHECK: repeat_zero: []
import Html exposing (text)
main =
let
_ = Debug.log "repeat1" (List.repeat 3 0)
_ = Debug.log "repeat_str" (List.repeat 2 "hi")
_ = Debug.log "repeat_zero" (List.repeat 0 "x")
in
text "done"