Blob


1 (defun make-sum (&rest nums)
2 (append (list '+) nums))
4 (make-sum '())
5 '(+)
6 (make-sum '(3))
7 '(+ 3)
8 (make-sum '(3 4))
9 '(+ 3 4)
10 (make-sum '(3 4 5))
11 '(+ 3 4 5)
12 (defun sum? (x)
13 (and (consp x) (eql (car x) '+)))
14 (defun addend (s)
15 (cadr s))
16 (defun augend (s)
17 (let ((aug (cddr s)))
18 (if (= (length aug) 1)
19 (car aug)
20 (append (list '+) aug))))
21 (defun make-product (&rest nums)
22 (append (list '*) nums))
23 (defun product? (x)
24 (and (consp x) (eql (car x) '*)))
25 (defun multiplier (s)
26 (cadr s))
27 (defun multiplicand (s)
28 (let ((m (cddr s)))
29 (if (= (length m) 1)
30 (car m)
31 (append (list '*) m))))