I am trying to use this simple function from this page: http://www.haskell.org/haskellwiki/99_questions/Solutions/2
But when I use it I got the non-exhaustive patterns error.The Code.
-- return one but last
lastButOne [x,_] = x
lastButone (_:xs) = lastButOne xs
And I call it like this:
lastButOne [1,2,3,4]
You have
lastButoneon your second line but you meanlastButOne. Whoops! 🙂