< 99 Elm Problems
Insert an element at a given position into a list.
import Html exposing (text)
import List
insertAt : Int -> a -> List a -> List a
-- your implementation goes here
main =
text <| toString <|
insertAt 2 42 [1..4]
Result:
[1, 42, 2, 3, 4]
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.