JsArrayUnsafeSetCharElementTest
`Array.set` on an `Array Char` replaces the element at the given index and leaves the original array unchanged. It sets index 0 and the last index, 3, each starting from the same four-element array.
Results
elm-0.19.1
passran in 51 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. original: ['a','b','c','d'] set_0: ['z','b','c','d'] set_3: ['a','b','c','x']
elm-0.19.2
passran in 69 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. original: ['a','b','c','d'] set_0: ['z','b','c','d'] set_3: ['a','b','c','x']
elm-0.19.3
passran in 83 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. original: ['a','b','c','d'] set_0: ['z','b','c','d'] set_3: ['a','b','c','x']
lamdera-1.5.0
passran in 62 msOutput
original: ['a','b','c','d'] set_0: ['z','b','c','d'] set_3: ['a','b','c','x']
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/JsArrayUnsafeSetCharElementTest] in its title.
Source
The -- CHECK: lines give the expected output.
module JsArrayUnsafeSetCharElementTest exposing (main)
{-| `Array.set` on an `Array Char` replaces the element at the given index and leaves the original array unchanged.
It sets index 0 and the last index, 3, each starting from the same four-element array.
-}
-- CHECK: original: ['a','b','c','d']
-- CHECK: set_0: ['z','b','c','d']
-- CHECK: set_3: ['a','b','c','x']
import Array
import Html exposing (text)
main =
let
arr : Array.Array Char
arr =
Array.fromList [ 'a', 'b', 'c', 'd' ]
_ =
Debug.log "original" (Array.toList arr)
_ =
Debug.log "set_0" (Array.toList (Array.set 0 'z' arr))
_ =
Debug.log "set_3" (Array.toList (Array.set 3 'x' arr))
in
text "done"