procedures as results
problem
- write a procedure make-fixed-app such that(make-fixed-app p) gives a procedure that can be supplied as the appreciator argument to compound-f, and which gives a fixed rate of p percent
solution
- define a procedure that returns a procedure
(define (make-fixed-app percent)
(lambda (gross year) (+ gross (* 0.01 percent gross))))
- sample evaluations
(define five-per-year (make-fixed-app 5))
(define ten-per-year (make-fixed-app 10))
(compound-flex 1000 five-per-year 20) ; evaluates to 2653
(compound-flex 1000 ten-per-year 20) ; evaluates to 6727