99 Elm Problems/Problem 19

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

Rotate a list N places to the left.

import Html exposing (text)
import List

rotate : Int -> List a -> List a
-- your implementation goes here

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

Result:

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

Solutions