ListTakeDropTest
List.take and List.drop return the expected prefix and suffix, including for a count of zero. `List.take 2` keeps the first two elements and `List.take 0` gives the empty list; `List.drop 2` removes the first two and `List.drop 0` returns the list unchanged.
Results
elm-0.19.1
passran in 54 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. take1: [1,2] take2: [] drop1: [3,4,5] drop2: [1,2,3,4,5]
elm-0.19.2
passran in 73 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. take1: [1,2] take2: [] drop1: [3,4,5] drop2: [1,2,3,4,5]
elm-0.19.3
passran in 68 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. take1: [1,2] take2: [] drop1: [3,4,5] drop2: [1,2,3,4,5]
lamdera-1.5.0
passran in 68 msOutput
take1: [1,2] take2: [] drop1: [3,4,5] drop2: [1,2,3,4,5]
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/ListTakeDropTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ListTakeDropTest exposing (main)
{-| List.take and List.drop return the expected prefix and suffix, including
for a count of zero.
`List.take 2` keeps the first two elements and `List.take 0` gives the empty
list; `List.drop 2` removes the first two and `List.drop 0` returns the list
unchanged.
-}
-- CHECK: take1: [1,2]
-- CHECK: take2: []
-- CHECK: drop1: [3,4,5]
-- CHECK: drop2: [1,2,3,4,5]
import Html exposing (text)
main =
let
_ = Debug.log "take1" (List.take 2 [1, 2, 3, 4, 5])
_ = Debug.log "take2" (List.take 0 [1, 2, 3])
_ = Debug.log "drop1" (List.drop 2 [1, 2, 3, 4, 5])
_ = Debug.log "drop2" (List.drop 0 [1, 2, 3, 4, 5])
in
text "done"