learning-sicp

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

exercise-4.scm (825B)


      1 (define-library (sicp tests chapter-1 exercise-4)
      2   (import (scheme base)
      3           (srfi :1)
      4           (srfi :64)
      5           (sicp solutions chapter-1 exercise-4))
      6 
      7   (begin
      8     (test-begin "chapter-1-exercise-4")
      9     (test-equal
     10         (+ 2 3)
     11       (a-plus-abs-b 2 3))
     12     (test-equal
     13         (+ -2 3)
     14       (a-plus-abs-b -2 3))
     15     (test-equal
     16         (- 2 -3)
     17       (a-plus-abs-b 2 -3))
     18     (test-equal
     19         (- -2 -3)
     20       (a-plus-abs-b -2 -3))
     21 
     22     (for-each
     23      (lambda (a)
     24        (for-each (lambda (b)
     25                    (test-equal
     26                        (a-plus-abs-b
     27                         a
     28                         b
     29                         )
     30                      (a-plus-abs-b-2
     31                       a
     32                       b
     33                       )))
     34                  (iota 10 -5)))
     35      (iota 10 -5))))