Skip to content

Instantly share code, notes, and snippets.

@Nirma
Created Sep 5, 2017
Embed
What would you like to do?
{- My personal solutions for problems 1 through 10 of
- https://wiki.haskell.org/99_questions/1_to_10-}
-- Problem 1: Find the last element of a list
problemOne :: [a] -> a
problemOne x = last x
-- Problem 2: Find the second to last element
problemTwo :: [a] -> a
problemTwo x = (!!1) $ reverse x
main = print $ problemTwo [1,2,3,4,5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment