learning-sicp

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

make.scm (1395B)


      1 (import (srfi srfi-1)
      2 
      3         (ice-9 pretty-print)
      4         (ice-9 regex))
      5 
      6 (define chapter-numbers '(1 2 3 4 5))
      7 (define number-of-exercises-per-chapter '(46 97 82 79 52))
      8 
      9 (define result
     10   (map (lambda (chapter number-of-exercises)
     11          (map (lambda (exercise)
     12                 (list (format #f
     13                               "sicp/solutions/chapter-~A/exercise-~A.scm"
     14                               chapter
     15                               exercise)
     16                       (format #f
     17                               "sicp/tests/chapter-~A/exercise-~A.scm"
     18                               chapter
     19                               exercise)
     20                       (format #f
     21                               "chapter-~A-exercise-~A.log"
     22                               chapter
     23                               exercise)))
     24               (iota number-of-exercises
     25                     1)))
     26        chapter-numbers
     27        number-of-exercises-per-chapter))
     28 
     29 (define-values (solutions tests tests-logs)
     30   (unzip3 (concatenate result)))
     31 
     32 (define (log-to-test log-name)
     33   (let* ((m (string-match "(chapter-[0-9]+)-(exercise-[0-9]+).log" log-name))
     34          (chapter (match:substring m 1))
     35          (exercise (match:substring m 2)))
     36     (format #t
     37             "sicp/tests/~A/~A.scm~%"
     38             chapter
     39             exercise)
     40     (format #f
     41             "sicp/tests/~A/~A.scm"
     42             chapter
     43             exercise)
     44 ))