99 Elm Problems/Problem 2
Appearance
Problem 2: Implement the function penultimate
to find the next to last element of a list.
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"
Result:
3