99 Elm 問題/問題 19
外觀
將列表向左旋轉 N 個位置。
import Html exposing (text)
import List
rotate : Int -> List a -> List a
-- your implementation goes here
main =
text <| toString <|
rotate 3 [1..10]
結果
[4, 5, 6, 7, 8, 9, 10, 1, 2, 3]
將列表向左旋轉 N 個位置。
import Html exposing (text)
import List
rotate : Int -> List a -> List a
-- your implementation goes here
main =
text <| toString <|
rotate 3 [1..10]
結果
[4, 5, 6, 7, 8, 9, 10, 1, 2, 3]