reverse a list

how to reverse a list in Lisp apart of using it's buid-in function reverse????

Who is Participating?
As for answering the posted question, ozo is right, use car to get the first element of the list, and cdr to get the rest of the list.  Build your result using cons, where the two parameters will be a recursive call to your reverse function and the head of the current list.
Is this a homework problem?
You probably want to use car cdr and cons
please what is "list in lisp" ???
LISP is a functional programming language designed to use lists.  Lists are defined by brackets as so:
( "a" 2 "c")
and embedded as so:
("a" (1 "b") ("c" ("d")))

which is a list with three elements, where the second element is a list with two elements, and the third element is a list with two elements, the second of which is a list.  Actually, only result lists display like that.  To define a list, use the List function, like this:

(List "a" 2 "c")

where you want the list elements to be the atoms "a", 2, and "c".
The solution is elegant, but I think EE rules are that we can't give actual homework answers, only answer questions and help with debugging your algorithm.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.