Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a LISP function(down lst) that wraps parentheses around each top-level ele

ID: 669899 • Letter: W

Question

Write a LISP function(down lst) that wraps parentheses around each top-level element of lst like in the following example.

> (down '(1 2 3))                                          

((1) (2) (3))                                              

> (down '(an idea))                                        

((AN) (IDEA))                                              

> (down '((a) (good) (idea)))                              

(((A)) ((GOOD)) ((IDEA)))                                  

> (down '(a (more (complicated)) idea))                    

((A) ((MORE (COMPLICATED))) (IDEA))                        

>          

Explanation / Answer

(defun down(lst)
(mapcar #'(lambda(x) ((x))) lst)
(terpri)
)
write (down '(a b c))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote