99 埃爾姆問題/第 8 個問題
外觀
< 99 埃爾姆問題
編寫一個函式來移除列表元素中的連續重複項。
import Html exposing (text)
import List
compress : List a -> List a
-- your implementation goes here
main = text (toString (compress [1, 1, 2, 2, 3, 3, 3, 4, 5, 4, 4, 4, 4]))
結果
[1, 2, 3, 4, 5, 4]