Sunday, January 29, 2012
Ex 4.46 reverse
Write your own definition of a Haskell operation "reverse" that reverses a list.
Solution:
myreverse :: [a] -> [a]
myreverse [] = []
myreverse (x:xs) = myreverse xs ++ [x]
Write your own definition of a Haskell operation "reverse" that reverses a list.
Solution:
myreverse :: [a] -> [a]
myreverse [] = []
myreverse (x:xs) = myreverse xs ++ [x]