Elm Exactly
Results / elm-core /

ListFoldrTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`List.foldr` folds from the right, shown by a sum and by `(++)` on strings,
where `"abc"` reveals the order.

Results

elm-0.19.1

passran in 68 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
sum: 10
concat: "abc"

elm-0.19.2

passran in 72 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
sum: 10
concat: "abc"

elm-0.19.3

passran in 50 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
sum: 10
concat: "abc"

lamdera-1.5.0

passran in 54 ms
Output
sum: 10
concat: "abc"

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ListFoldrTest exposing (main)
{-| `List.foldr` folds from the right, shown by a sum and by `(++)` on strings,
where `"abc"` reveals the order.
-}
-- CHECK: sum: 10
-- CHECK: concat: "abc"
import Html exposing (text)
main =
let
_ = Debug.log "sum" (List.foldr (+) 0 [1, 2, 3, 4])
_ = Debug.log "concat" (List.foldr (++) "" ["a", "b", "c"])
in
text "done"