99 questions/Solutions/1
< 99 questions | Solutions
Jump to navigation
Jump to search
Revision as of 15:09, 13 July 2010 by Wapcaplet (talk | contribs) (Copied solution from 99 questions/1 to 10)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
(*) Find the last element of a list.
myLast :: [a] -> a
myLast [x] = x
myLast (_:xs) = myLast xs
myLast' = foldr1 (const id)
myLast'' = head . reverse
The Prelude
also provides the function last
.