Note that the trivial solution
reverse a = foldr (\\b c -> c ++ [b] ) [] a
is not very efficient, because of the quadratic growth in complex
old question, I know, but is there anything non-optimal about this approach, it seems like foldr would be faster due to lazy evaluation and the code is fairly concise:
reverse' :: [a] -> [a]
reverse' = foldr (\x acc -> acc ++ [x]) []
is (++) significantly slower than (:), which requires a few logical twists as shown in FUZxxl's answer