# SICP 2.3 exercises

2.53
(list ‘a ‘b ‘c)
(a b c)

(list (list ‘george))
((george))

(cdr ‘((x1 x2) (y1 y2)))
((y1 y2))

(y1 y2)

(pair? (car ‘(a short list)))
#f

(memq ‘red ‘((red shoes) (blue socks)))
#f

(memq ‘red ‘(red shoes blue socks))
(red shoes blue socks)

2.54

```(define (equal?-2 a b)
(if (and (or (null? a) (not (pair? a)))
(or (null? b) (not (pair? b))))
(eq? a b)
(if (and (pair? a) (pair? b))
(and (equal?-2 (car a) (car b))
(equal?-2 (cdr a) (cdr b)))
#f)))
```

2.55
‘something is synctactic sugar for (quote something). Therefore ”abracadabra also means (quote (quote abracadabra)) which is (quote abracadabra). Finally, (car (quote abracadabra)) is quote.

2.56

```(define (deriv exp var)
(cond ((number? exp) 0)
((variable? exp)
(if (same-variable? exp var) 1 0))
((sum? exp)
(deriv (augend exp) var)))
((product? exp)
(make-sum
(make-product (multiplier exp)
(deriv (multiplicand exp) var))
(make-product (deriv (multiplier exp) var)
(multiplicand exp))))
((exponentiation? exp)
(make-product (exponent exp)
(make-exponentiation (base exp)
(make-sum (exponent exp) -1))))
(else
(error "unknown expression type -- DERIV" exp))))

(define (exponentiation? x)
(and (pair? x) (eq? (car x) '**)))

(define (base exp)

(define (exponent exp)

(define (make-exponentiation b e)
(cond ((=number? e 0) 1)
((=number? e 1) b)
(else (list '** b e))))
```

Trivial, which is the point of this exercise. The one catch is to remember to use make-sum instead of ‘-‘ in deriv so that it can handle variable exponents.

```(define (augend s)
(if (null? (cdddr s))