Question: Part A: Complete the questions about LISP below. Use the LISP interpreter to evaluate the commands. 5. What do each of the following expressions evaluate
Part A: Complete the questions about LISP below. Use the LISP interpreter to evaluate the commands.




5. What do each of the following expressions evaluate to?
Answer
| | Question | Answer |
1 2 3 4 5 6 7 | (list 'cons t nil) (eval (list 'cons t nil)) (eval (eval (list 'cons t nil))) (apply #'cons '(t nil)) (eval nil) (list 'eval nil) (eval (list 'eval nil)) | |
6. What is the result of the following Lisp expression?
| | (setf line '(roses are red)) | Answer |
1 | (reverse line) | |
2 | (first (last line)) | |
3 | (nth 1 line) | |
4 | (reverse (reverse line)) | |
5 | (append line (list (first line))) | |
6 | (append (last line) line) | |
7 | (list (first line) (last line)) | |
8 | (cons (last line) line) | |
9 | (remove 'are line) | |
10 | (append line '(violets are blue)) | |
7. What would be the result of the following expression(s)? Answer in T or NIL.
| | (setf x1 (list 'a 'b 'c)) (setf x2 (list 'a 'b 'c)) (setf z x1) | Answer |
1 | (equal x1 x2) | |
2 | (eq x1 x2) | |
3 | (eq z x1) | |
4 | (eq z '(a b c)) | |
5 | (equal z '(a b c)) | |
6 | (eql 'foo 'foo) | |
7 | (eql 3 3.0) | |
8 | (= 3 3.0) | |
9 | (car NIL) | |
10 | (cdr NIL) | |
Part A: Complete the questions about LISP below. Use the LISP interpreter to evaluate the commands 1. What is the parenthesis notation for this cons cell structure? NIL NIL NIL BOWS ARROWS FLOWERS CHOCOLATES Answer: NIL NIL Answer Part A: Complete the questions about LISP below. Use the LISP interpreter to evaluate the commands 1. What is the parenthesis notation for this cons cell structure? NIL NIL NIL BOWS ARROWS FLOWERS CHOCOLATES Answer: NIL NIL
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
