learning-sicp

My embarrassing half assed SICP run.
git clone https://kaka.farm/~git/learning-sicp
Log | Files | Refs

exercise-7.scm (1586B)


      1 (define-library (sicp tests chapter-2 exercise-7)
      2   (import (scheme base)
      3           (srfi :64)
      4           (sicp solutions chapter-2 exercise-7))
      5 
      6   (begin
      7                                         ; XXX Break these down to specific solutions and tests.
      8 
      9     (test-begin "chapter-2-exercise-7")
     10 
     11     ;; TODO: WHERE ARE THE TESTS?!
     12     #;
     13     ((width-interval (add-interval x y))
     14      (width-interval (make-interval (+ (lower-bound x)
     15                                        (lower-bound y))
     16                                     (+ (upper-bound x)
     17                                        (upper-bound y))))
     18      (/ (- (upper-bound (make-interval (+ (lower-bound x)
     19                                           (lower-bound y))
     20                                        (+ (upper-bound x)
     21                                           (upper-bound y))))
     22            (lower-bound (make-interval (+ (lower-bound x)
     23                                           (lower-bound y))
     24                                        (+ (upper-bound x)
     25                                           (upper-bound y)))))
     26         2)
     27      (/ (- (+ (upper-bound x)
     28               (upper-bound y))
     29            (+ (lower-bound x)
     30               (lower-bound y)))
     31         2)
     32 
     33      (add-interval (width-interval x)
     34                    (width-interval y))
     35      (add-interval (/ (- (upper-bound x) (lower-bound x)) 2)
     36                    (/ (- (upper-bound y) (lower-bound y)) 2))
     37      (make-interval ((/ (- (upper-bound x) (lower-bound x)) 2))
     38                     (/ (- (upper-bound y) (lower-bound y)) 2)))
     39     (test-end "chapter-2-exercise-7")))