nguln
asked on
reverse a list
how to reverse a list in Lisp apart of using it's buid-in function reverse????
thanks
thanks
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".
( "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".
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
You probably want to use car cdr and cons