Solution to SICP Exercise 1.44

Structure and Interpretation of Computer Programs

Solution to Exercise 1.44:

(define (average-3 a b c)
(/ (+ a b c) 3))

(define (smooth f dx)
(lambda (x) (average-3 (f (- x dx))
(f x)
(f (+ x dx)))))

(define (n-fold-smooth f dx n)
(repeated (lambda (g) (smooth g dx)) n) f)

%d bloggers like this: