sicp-solutions/chapter-2/ex-2.08.scm

15 lines
300 B
Scheme

#lang sicp
(define (make-interval a b) (cons a b))
(define (lower-bound i)
(car i))
(define (upper-bound i)
(cdr i))
(define (sub-interval a b)
(make-interval (- (lower-bound a)
(upper-bound b))
(- (upper-bound a)
(lower-bound b))))