You idea is ok, but you need to translate it to scheme.
The function
reverse does not change its argument, it instead creates a new list and
returns it. That is, you have to write:
- Code: Select all
(setf list (reverse list))
Note the parenthesis surrounding the name of the function and its argument, not only its argument.
About
car, you got it wrong. The function
car returns the first element, not the tail of the list. What you want is
cdr. And you need to use setf again, because
cdr does not change its argument, it just returns the correct value:
- Code: Select all
(setf list (cdr list))
I think this is enough for you to get the idea. Good luck!