-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex-2.73.scm
29 lines (26 loc) · 893 Bytes
/
ex-2.73.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
; 2.73 b
(define (install-sum-package)
(define (deriv-sum opperands var)
(let (exp (apply make-sum opperands))
(make-sum (deriv (addend exp) var)
(deriv (augend exp) var))))
(put 'deriv '+ deriv-sum))
(define (install-product-package)
(define (deriv-product opperands var)
(let (exp (apply make-product opperands))
(make-sum
(make-product (multiplier exp)
(deriv (multiplicand exp) var))
(make-product (deriv (multiplier exp) var)
(multiplicand exp)))))
(put 'deriv '* deriv-product))
; 2.73 c
(define (install-exp-package)
(define (deriv-exp opperands var)
(let (exp (apply make-exp opperands))
(make-product
(make-product
(exponent exp)
(make-exp (base exp) (- (exponent exp) 1)))
(deriv (base exp) var))))
(put 'derv '** deriv-exp))