Answers

Faiz ul haque Zeya

 

Chapter 1

1 a. (+ 3  4  5  6 7 )

   b. ( *  (+ 3 5) ( + 4 5))

   c. (/ 4 (+ 4 3))

 

 

2.(defun  add2 (x) (+ x  2 ))

 

3. (defun  exp (a b c d) ( + a b  d (/  c 2)))

 

4. 1. (car (cdr  x))

    2. (car ( cdr (cdr x)))

 

Chapter 2

 

  1. (defun func1 (name) (if (equal name “Johnson”) (write “ You are welcome”) (write “User not allowed”))
  2. (defun func2 (name) (setf  name2 (read)) (cond (( equal  name name2 ) (write “yes”)) (t )))
  3. (defun func3 (n) (do ( (j  n (- j 1))) ((equal j 0)) (write j)))

 

 

Chapter 3

   

    1. (make-array '(2 4) :initial-contents '((1 2 3 4)(12 3 4 5) ))

    2. (nth 3 (list 1 2 3 4))

    3.(string= "faiz" "faiz")