#### Assignments Due

#### Notes and Questions

A List is either: (1) **null**, or (2) a Pair whose second element is
a List.

All of our List procedures depend on this definition, so it is important
to know and understand it well.

#### List Procedures

(define (is-list? p)
(if (null? p)
true
(if (pair? p)
(is-list? (cdr p))
false)))

(define (list-sum p)
(if (null? p)
0
(+ (car p) (list-sum (cdr p)))))

(define (deep-list-sum p)
(if (null? p)
0
(+ (if (list? (car p))
(deep-list-sum (car p))
(car p))
(deep-list-sum (cdr p)))))

(define (list-length p)
(if (null? p)
0
(+ 1 (list-length (cdr p)))))

### Tracing

A helpful way to see what is going on when an expression is evaluated is
to use the tracing. See Section 4.5.2 of the coursebook for details.

(require (lib "trace.ss"))
(trace deep-list-sum)

### Closest Number

Define

`find-closest-number`, a procedure that takes two
parameters, a goal and a list of numbers, and produces the number in the
list numbers list that is closest to goal.