In my functional programming class, the lecturer created the function reverse
to take a list and return a list with the same elements but in reverse order:
reverse :: [a] -> [a]
reverse [] = []
reverse (x:xs) = reverse xs ++ [x]
However, in the book I am learning from the define they create the same function with ' after the function's name:
reverse' :: [a] -> [a]
reverse' [] = []
reverse' (x:xs) = reverse' xs ++ [x]
I was wondering if these two functions behave in the same way, or if the ' alters their behavior? Furthermore, are there cases where one notation is better than the other? Any help would be appreciated!