Code: Select all

```
(define value
(lambda (n)
(if (atom- n)
n
(if (eq? (car (cdr n)) '0+)
(0+ (car n)(value (car (cdr (cdr n)))))
(if (eq? (car (cdr n)) '0*)
(0* (car n)(value (car (cdr (cdr n)))))
(if (eq? (car (cdr n)) '0-)
(0- (car n)(value (car (cdr (cdr n)))))
(if (eq? (car (cdr n)) '0/)
(0/ (car n)(value (car (cdr (cdr n)))))
(if (eq? (car (cdr n)) '0^)
(0^ (car n)(value (car (cdr (cdr n)))))
#f))))))))
```

Code: Select all

```
(define alist '((0+ 0+)(0* 0*)(0- 0-)(0/ 0/)(0^ 0^)))
(define value
(lambda (n)
(if (atom- n)
n
(let ((f (assq (car (cdr n)) alist)))
(if (or (eq? (car (cdr n)) '0+)
(eq? (car (cdr n)) '0*)
(eq? (car (cdr n)) '0-)
(eq? (car (cdr n)) '0/)
(eq? (car (cdr n)) '0^))
(f (car n) (value (car (cdr (cdr n)))))
#f)))))
```