Reputation: 65
I know my answer is dead wrong, I would like to know how I would be able to reach the answer. What did I do wrong?
X = (setf X '(88 ((11 21 31 41)) (90 91 92 93)))
I have to write LISP expression which evaluates to the list:
(11 (11 21 31 41) (88 90 91 92 93))
My Answer:
(list (caadr X) (cdddr X))
Upvotes: 1
Views: 55
Reputation: 66371
These should get you going:
CL-USER> (cadr X)
((11 21 31 41))
CL-USER> (caadr X)
(11 21 31 41)
CL-USER> (caaadr X)
11
CL-USER> (cons (caaadr X) (cadr X))
(11 (11 21 31 41))
CL-USER> (caddr X)
(90 91 92 93)
CL-USER> (car X)
88
CL-USER> (cons (car X) (caddr X))
(88 90 91 92 93)
(Experimenting in the REPL is a very effective way of finding things out.)
Upvotes: 1