summaryrefslogtreecommitdiff
path: root/h1.hs
blob: f0216c2b5d1f0b392bc83a22852668e896a1f328 (plain)
1
2
3
4
5
6
7
8
9

myLast :: [a] -> a
myLast [] = error "Empty List"
myLast [x] = x
myLast (x:xs) = myLast xs

myLast' = foldl1 (flip const)

myLast'' = foldl1 (curry snd)