learning-sicp

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

exercise-32.scm (1779B)


      1 (define-library (sicp tests chapter-1 exercise-32)
      2   (import (scheme base))
      3   (import (srfi :64))
      4   (import (prefix (sicp solutions chapter-1 exercise-30) 1_30:))
      5   (import (prefix (sicp solutions chapter-1 exercise-31) 1_31:))
      6   (import (prefix (sicp solutions chapter-1 exercise-32) 1_32:))
      7 
      8   (begin
      9     (test-begin "chapter-1-exercise-32")
     10     (test-equal
     11         (1_30:iterative-sum (lambda (x) (* x x))
     12                             5
     13                             (lambda (x) (* 2 x))
     14                             20)
     15       (1_32:iterative-sum (lambda (x) (* x x))
     16                           5
     17                           (lambda (x) (* 2 x))
     18                           20)
     19       )
     20     (test-equal
     21         (1_30:iterative-sum (lambda (x) (* x x))
     22                             5
     23                             (lambda (x) (* 2 x))
     24                             20)
     25       (1_32:recursive-sum (lambda (x) (* x x))
     26                           5
     27                           (lambda (x) (* 2 x))
     28                           20)
     29       )
     30     (test-equal
     31         (1_31:iterative-product (lambda (x) (* x x))
     32                                 5
     33                                 (lambda (x) (* 2 x))
     34                                 20)
     35       (1_32:iterative-product (lambda (x) (* x x))
     36                               5
     37                               (lambda (x) (* 2 x))
     38                               20))
     39     (test-equal
     40         (1_31:iterative-product (lambda (x) (* x x))
     41                                 5
     42                                 (lambda (x) (* 2 x))
     43                                 20)
     44       (1_32:recursive-product (lambda (x) (* x x))
     45                               5
     46                               (lambda (x) (* 2 x))
     47                               20))
     48     (test-end "chapter-1-exercise-32")))