99 Elm Problems/Problem 2/Solutions
Solution 1: Recursive search for the next to last element
penultimate list =
case list of
[] -> Nothing
next :: [_] -> Just next
_ :: tail -> penultimate tail
Solution 2: Functional composition
import List exposing (reverse, drop, head)
penultimate =
(reverse >> drop 1 >> head)