I'm having trouble with the following exercise :
I'm supposed to reverse all elements in a list except for the first one, the first element of the list must stay in its original position.
Correct Example:
input: rvrsTail [1,2,3,4,5]
output [1,5,4,3,2]
What I have done so far:
rvrsTail :: [x] -> [x]
rvrsTail xs = reverse ( tail xs)
This does reverse the the tail of the list but removes the first element, and since I can't store the first element in a variable I can't seem to understand how to solve this issue.
Erroneous Output:
input: rvrsTail [1,2,3,4,5]
output [5,4,3,2]
Since this is supposed to be a beginner's exercise, the solution should be simple.