2.01
(define (make-rat x y)
(let ((g (gcd x y)))
(if (< y 0)
(cons (/ (- x) g) (/ (- y) g))
(cons (/ x g) (/ y g)))))
2.02
(define (make-point x y) (cons x y))
(define (x-point p) (car p))
(define (y-point p) (cdr p))
(define (make-segment p1 p2) (cons p1 p2))
(define (start-seg line) (car line))
(define (end-seg line) (cdr line))
(define (midpoint-segment line)
(make-point (/ (+ (x-point (start-seg line)) (x-point (end-seg line))) 2.0)
(/ (+ (y-point (start-seg line)) (y-point (end-seg line))) 2.0)))
2.04
;;;;;;;;;;;;;;;;;;;;;;;;;
; (cdr+ (cons+ x y) = ((cons+ x y) (lambda(p q) p)))
; = (lambda(m)(m x y) (lambda(p q) p)))
; = ((lambda(p q) p) x y)
; = x
(define (cons+ x y)
(lambda(m) (m x y)))
(define (car+ z)
(z (lambda(p q) p)))
(define (cdr+ z)
(z (lambda(p q) q)))
2.05
2^a * 3^b = 2^c * 3^d (a!=c && b!=d)
2^a/2^c = 3^d/3^b
2^(a-c) = 3^(d-b)
a=c && d=b
2.06
(define one (lambda(f) (lambda(x) (f x))))
(define two (lambda(f) (lambda(x) (f (f x)))))
2.07
(define (upper-bound pair)
(if (> (car pair) (cdr pair))
(car pair)
(cdr pair)))
(define (lower-bound pair)
(if (> (car pair) (cdr pair))
(cdr pair)
(car pair)))
2.08
(define (sub-interval x y)
(add-interval x (make-interval (- (upper-bound y))
(- (lower-bound y)))))