SICP - Solution: Exercise 2.8

SICP - Solution: Exercise 2.8

January 10, 2019

Exercise 2.8 #

Using reasoning analogous to Alyssa’s, describe how the difference of two intervals may be computed. Define a corresponding subtraction procedure, called sub-interval.

Solution #

(define (sub-interval x y)
  (make-interval (- (lower-bound x)
                    (upper-bound y))
                 (- (upper-bound x)
                    (lower-bound y))))