99 Elm 问题/问题 2
外观
问题 2:实现函数 penultimate
以找出列表的倒数第二项。
import Html exposing (text)
import List
import Maybe
penultimate : List a -> Maybe a
-- your implementation goes here
main =
case penultimate (List.range 1 4) of
Just a -> text (toString a)
Nothing -> text "No element found"
结果
3