|
-- Find second element from the end of a list
|
|
-- complete
|
|
|
|
myButLast :: [a] -> a
|
|
myButLast [] = error "List empty"
|
|
myButLast [x] = error "Single element list"
|
|
myButLast x = myButLastAux (reverse x)
|
|
|
|
myButLastAux :: [a] -> a
|
|
myButLastAux (x:xs:xss) = xs
|