Note that the trivial solution
reverse a = foldr (\\b c -> c ++ [b] ) [] a
is not very efficient, because of the quadratic growth in complex
Basically, you need to transform 1:2:3:[] into (3:).(2:).(1:) and apply it to []. Thus:
reverse' xs = foldr (\x g -> g.(x:)) id xs []
The meaning of the accumulated g here is that it acts on its argument by appending the reversed partial tail of xs to it.
For the 1:2:3:[] example, in the last step x will be 3 and g will be (2:).(1:).