learning-sicp

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

exercise-8.scm (645B)


      1 (define-library (sicp tests chapter-1 exercise-8)
      2   (import (scheme base)
      3           (scheme write)
      4           (srfi :64)
      5           (sicp solutions chapter-1 exercise-8))
      6 
      7   (begin
      8     (test-begin "chapter-1-exercise-8")
      9 
     10     (test-expect-fail 1)
     11     ;; XXX: I don't get the approximation here.
     12     (for-each
     13      (lambda (x)
     14        (let ((expected (expt (expt x 3)
     15                              (/ 1.0 3)))
     16              (test-expr (cube-root (expt x 3)))
     17              (error 0.01))
     18          (test-approximate
     19              expected
     20            test-expr
     21            error)))
     22      (list 20000000000000
     23            2
     24            (/ 1 20000000000000)))))