Skip to content

Instantly share code, notes, and snippets.

@funrep
Created October 22, 2012 17:20
Show Gist options
  • Save funrep/3932740 to your computer and use it in GitHub Desktop.
Save funrep/3932740 to your computer and use it in GitHub Desktop.
lastButOne :: [a] -> a
lastButOne xs
| xs == [] = "Sorry, empy list!"
| length xs == 1 = "Sorry, too short list!"
| otherwise = last (init xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment