learning-sicp

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

exercise-12.scm (767B)


      1 (define-library (sicp tests chapter-1 exercise-12)
      2   (import (scheme base)
      3           (scheme cxr)
      4           (srfi :64)
      5           (sicp solutions chapter-1 exercise-12))
      6 
      7   (begin
      8     (test-begin "chapter-1-exercise-12")
      9     (for-each
     10      (lambda (expected-line-column)
     11        (let ((expected (car expected-line-column))
     12              (line (cadr expected-line-column))
     13              (column (caddr expected-line-column)))
     14          (test-equal
     15              expected
     16            (pascal line column))))
     17      '((1 0 0)
     18        (1 1 0)
     19        (1 1 1)
     20        (1 2 0)
     21        (2 2 1)
     22        (1 2 2)
     23        (1 3 0)
     24        (3 3 1)
     25        (3 3 2)
     26        (1 3 3)
     27        (1 4 0)
     28        (4 4 1)
     29        (6 4 2)
     30        (4 4 3)
     31        (1 4 4)))
     32     (test-end "chapter-1-exercise-12")))