99 Elm Problems/Problem 17

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Split a list into two parts; the length of the first part is given.

import Html exposing (text)
import List

split : Int -> List a -> (List a, List a)
-- your implementation goes here

main = text <| toString <|
  split 3 [1..10]

Result:

([1, 2, 3], [4, 5, 6, 7, 8, 9, 10])

Solutions