learning-sicp

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

exercise-5.scm (771B)


      1 (define-library (sicp tests chapter-4 exercise-5)
      2   (import (scheme base)
      3 
      4           (srfi :64)
      5 
      6           (sicp solutions chapter-4 exercise-5))
      7 
      8   (begin
      9     (test-begin "chapter-4-exercise-5")
     10 
     11     (test-equal 1
     12       (eval '(cond
     13               (else 1))
     14             (setup-environment)))
     15 
     16     (test-equal 1
     17       (eval '(cond
     18               (true 1)
     19               (else 2))
     20             (setup-environment)))
     21 
     22     (test-equal 2
     23       (eval '(+ (cond
     24                  (false 1)
     25                  (else (+ -4 6)))
     26                 0)
     27             (setup-environment)))
     28 
     29     (test-equal 5
     30       (eval '(cond
     31               (false 1)
     32               ((+ 2 3) => (lambda (x) 8 x))
     33               (else 2))
     34             (setup-environment)))
     35 
     36     (test-end "chapter-4-exercise-5")))