Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
12 lines (9 sloc) 203 Bytes
last' :: [a] -> a
last' [] = undefined
last' [x] = x
last' (x:xs) = last' xs
last'' :: [a] -> a
last'' = head . reverse
main = do
print $ last' "abcd"
print $ last'' "abcd"