learning-sicp

My embarrassing half assed SICP run.
Log | Files | Refs

commit e6a24f57fa8a1900f25bfb92529751ea31cf9170
parent 3bc4c9e912695777cb17fa93fb2e1fd4f541deb7
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Tue, 14 Nov 2023 00:16:05 +0200

Rename tests into "chapter-x-exercise-y" for all chapter number x and exercise number y.

Diffstat:
Msicp/tests/chapter-1/exercise-21.scm | 2+-
Msicp/tests/chapter-2/exercise-35.scm | 4++--
Msicp/tests/chapter-2/exercise-36.scm | 4++--
Msicp/tests/chapter-2/exercise-40.scm | 4++--
Msicp/tests/chapter-2/exercise-41.scm | 4++--
Msicp/tests/chapter-2/exercise-61.scm | 4++--
Msicp/tests/chapter-2/exercise-67.scm | 4++--
Msicp/tests/chapter-2/exercise-68.scm | 4++--
Msicp/tests/chapter-2/exercise-69.scm | 4++--
Msicp/tests/chapter-2/exercise-70.scm | 4++--
Msicp/tests/chapter-2/exercise-71.scm | 4++--
Msicp/tests/chapter-2/exercise-73.scm | 4++--
Msicp/tests/chapter-2/exercise-75.scm | 4++--
Msicp/tests/chapter-3/exercise-1.scm | 4++--
Msicp/tests/chapter-3/exercise-12.scm | 4++--
Msicp/tests/chapter-3/exercise-13.scm | 4++--
Msicp/tests/chapter-3/exercise-14.scm | 4++--
Msicp/tests/chapter-3/exercise-15.scm | 4++--
Msicp/tests/chapter-3/exercise-16.scm | 4++--
Msicp/tests/chapter-3/exercise-17.scm | 4++--
Msicp/tests/chapter-3/exercise-18.scm | 4++--
Msicp/tests/chapter-3/exercise-19.scm | 4++--
Msicp/tests/chapter-3/exercise-2.scm | 4++--
Msicp/tests/chapter-3/exercise-21.scm | 4++--
Msicp/tests/chapter-3/exercise-22.scm | 4++--
Msicp/tests/chapter-3/exercise-23.scm | 4++--
Msicp/tests/chapter-3/exercise-25.scm | 4++--
Msicp/tests/chapter-3/exercise-3.scm | 4++--
Msicp/tests/chapter-3/exercise-4.scm | 4++--
Msicp/tests/chapter-3/exercise-6.scm | 4++--
Msicp/tests/chapter-3/exercise-7.scm | 4++--
Msicp/tests/chapter-3/exercise-8.scm | 4++--
32 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/sicp/tests/chapter-1/exercise-21.scm b/sicp/tests/chapter-1/exercise-21.scm @@ -39,7 +39,7 @@ ;; XXX - (test-group "1.21" + (test-group "chapter-1-exercise-21" (let ((cases '(199 1999 19999)) (results '(199 1999 7))) (test-equal diff --git a/sicp/tests/chapter-2/exercise-35.scm b/sicp/tests/chapter-2/exercise-35.scm @@ -6,8 +6,8 @@ (define t '((1 2 3) (3 (4 5 6) (2 3)))) - (test-begin "2.35") + (test-begin "chapter-2-exercise-35") (test-equal (count-leaves-2.2.2 t) (count-leaves t)) - (test-end "2.35"))) + (test-end "chapter-2-exercise-35"))) diff --git a/sicp/tests/chapter-2/exercise-36.scm b/sicp/tests/chapter-2/exercise-36.scm @@ -4,11 +4,11 @@ (sicp solutions chapter-2 exercise-36)) (begin - (test-begin "2.36") + (test-begin "chapter-2-exercise-36") (test-equal '(22 26 30) (accumulate-n + 0 '((1 2 3) (4 5 6) (7 8 9) (10 11 12)))) - (test-end "2.36"))) + (test-end "chapter-2-exercise-36"))) diff --git a/sicp/tests/chapter-2/exercise-40.scm b/sicp/tests/chapter-2/exercise-40.scm @@ -4,7 +4,7 @@ (sicp solutions chapter-2 exercise-40)) (begin - (test-begin "2.40") + (test-begin "chapter-2-exercise-40") (test-equal '((2 1) (3 1) (3 2) @@ -13,4 +13,4 @@ (test-equal (prime-sum-pairs 20) (my-prime-sum-pairs 20)) - (test-end "2.40"))) + (test-end "chapter-2-exercise-40"))) diff --git a/sicp/tests/chapter-2/exercise-41.scm b/sicp/tests/chapter-2/exercise-41.scm @@ -16,8 +16,8 @@ (5 4 2) (5 4 3))) - (test-begin "2.41") + (test-begin "chapter-2-exercise-41") (test-equal ratsui (unique-triples 5)) - (test-end "2.41"))) + (test-end "chapter-2-exercise-41"))) diff --git a/sicp/tests/chapter-2/exercise-61.scm b/sicp/tests/chapter-2/exercise-61.scm @@ -3,7 +3,7 @@ (srfi :64)) (begin - (test-begin "2.61") + (test-begin "chapter-2-exercise-61") (test-equal '(1) (adjoin-set 1 '())) @@ -19,4 +19,4 @@ (test-equal '(1 2 3 4 5 6) (adjoin-set 3 '(1 2 4 5 6))) - (test-end "2.61"))) + (test-end "chapter-2-exercise-61"))) diff --git a/sicp/tests/chapter-2/exercise-67.scm b/sicp/tests/chapter-2/exercise-67.scm @@ -4,9 +4,9 @@ (sicp solutions huffman-codes-stuff)) (begin - (test-begin "2.67") + (test-begin "chapter-2-exercise-67") (test-equal '(A D A B B C A) ;; Is this it? Did I fuck any shit up? Manuel de Coding, the Portuguese decoder, agrees with this. (decode sample-message sample-tree)) - (test-end "2.67") + (test-end "chapter-2-exercise-67") )) diff --git a/sicp/tests/chapter-2/exercise-68.scm b/sicp/tests/chapter-2/exercise-68.scm @@ -4,12 +4,12 @@ (sicp solutions huffman-codes-stuff)) (begin - (test-begin "2.68") + (test-begin "chapter-2-exercise-68") (test-equal sample-message (encode (decode sample-message sample-tree) sample-tree)) - (test-end "2.68"))) + (test-end "chapter-2-exercise-68"))) diff --git a/sicp/tests/chapter-2/exercise-69.scm b/sicp/tests/chapter-2/exercise-69.scm @@ -11,7 +11,7 @@ (A B C D) 4) -(test-begin "2.69") +(test-begin "chapter-2-exercise-69") (test-equal (make-leaf 'A 1) (generate-huffman-tree '((A 1)))) @@ -25,4 +25,4 @@ (C 1) (B 2) (A 4)))) -(test-end "2.69") +(test-end "chapter-2-exercise-69") diff --git a/sicp/tests/chapter-2/exercise-70.scm b/sicp/tests/chapter-2/exercise-70.scm @@ -64,7 +64,7 @@ Sha boom") (encode song-message songs-huffman-tree)) -(test-begin "2.70") +(test-begin "chapter-2-exercise-70") (test-equal 84 (length encoded-song-message)) @@ -77,7 +77,7 @@ Sha boom") 1) ;; minus one to get the number of spaces between symbols (map string-length only-letters-song-message))))) ;; plus the number of characters in each symbol. -(test-end "2.70") +(test-end "chapter-2-exercise-70") ;; We count consecutive whitespaces - newline and a spacey space - as a single ;; space delimiting the symbols. diff --git a/sicp/tests/chapter-2/exercise-71.scm b/sicp/tests/chapter-2/exercise-71.scm @@ -79,7 +79,7 @@ ;; / \ ;; B 2 A 1 -(test-begin "2.71") +(test-begin "chapter-2-exercise-71") (test-equal (make-code-tree (make-leaf 'E 16) @@ -116,7 +116,7 @@ (generate-huffman-tree (zip '(A B C D E F G H I J) (map (cut expt 2 <>) (iota 10 0))))) -(test-end "2.71") +(test-end "chapter-2-exercise-71") ;; For n encoded symbols, the most frequent symbol would need 1 bit and the ;; least frequent symbol would need (n - 1) bits. diff --git a/sicp/tests/chapter-2/exercise-73.scm b/sicp/tests/chapter-2/exercise-73.scm @@ -13,7 +13,7 @@ ;; (write ((get 'a 'b) 1+ '(1 2 3))) (newline) - ;; (test-begin "2.73") + ;; (test-begin "chapter-2-exercise-73") ;; (test-equal 1 1) - ;; (test-end "2.73") + ;; (test-end "chapter-2-exercise-73") )) diff --git a/sicp/tests/chapter-2/exercise-75.scm b/sicp/tests/chapter-2/exercise-75.scm @@ -4,7 +4,7 @@ (sicp solutions chapter-2 exercise-75))) (begin - (test-begin "2.75") + (test-begin "chapter-2-exercise-75") (test-equal ((make-from-mag-ang 1.0 0.0) 'real-part) 1.0) @@ -17,4 +17,4 @@ (test-equal ((make-from-mag-ang 1 0.0) 'angle) 0.0) - (test-end "2.75")) + (test-end "chapter-2-exercise-75")) diff --git a/sicp/tests/chapter-3/exercise-1.scm b/sicp/tests/chapter-3/exercise-1.scm @@ -7,7 +7,7 @@ (define A (make-accumulator 5)) (define B (make-accumulator 0)) - (test-begin "3.1") + (test-begin "chapter-3-exercise-1") (test-equal 15 (A 10)) @@ -20,4 +20,4 @@ (test-equal 20 (B 10)) - (test-end "3.1"))) + (test-end "chapter-3-exercise-1"))) diff --git a/sicp/tests/chapter-3/exercise-12.scm b/sicp/tests/chapter-3/exercise-12.scm @@ -16,7 +16,7 @@ ;; | ;; z: ['a | -]-> ['b | -]--+ - (test-begin "3.12") + (test-begin "chapter-3-exercise-12") (test-equal '(a b c d) z) @@ -47,4 +47,4 @@ (test-equal '(b c d) (cdr x)) - (test-end "3.12"))) + (test-end "chapter-3-exercise-12"))) diff --git a/sicp/tests/chapter-3/exercise-13.scm b/sicp/tests/chapter-3/exercise-13.scm @@ -7,6 +7,6 @@ (begin (define z (make-cycle (list 'a 'b 'c))) - (test-begin "3.13") + (test-begin "chapter-3-exercise-13") (test-error (last-pair z)) ; Guile's last-pair checks for and raises an error on cyclic lists. - (test-end "3.13"))) + (test-end "chapter-3-exercise-13"))) diff --git a/sicp/tests/chapter-3/exercise-14.scm b/sicp/tests/chapter-3/exercise-14.scm @@ -3,7 +3,7 @@ (import (srfi :64)) (begin - (test-begin "3.14") + (test-begin "chapter-3-exercise-14") (define v '(a b c d)) @@ -209,4 +209,4 @@ (test-equal '() x) (test-equal '(d c b a) y) (test-equal '(a) v) - (test-end "3.14"))) + (test-end "chapter-3-exercise-14"))) diff --git a/sicp/tests/chapter-3/exercise-15.scm b/sicp/tests/chapter-3/exercise-15.scm @@ -3,7 +3,7 @@ (import (srfi :64)) (begin - (test-begin "3.15") + (test-begin "chapter-3-exercise-15") (define (set-to-wow! x) (set-car! (car x) 'wow) @@ -75,4 +75,4 @@ (test-equal '((wow b) wow b) z1) (test-equal '((wow b) a b) z2) - (test-end "3.15"))) + (test-end "chapter-3-exercise-15"))) diff --git a/sicp/tests/chapter-3/exercise-16.scm b/sicp/tests/chapter-3/exercise-16.scm @@ -3,7 +3,7 @@ (import (srfi :64)) (begin - (test-begin "3.16") + (test-begin "chapter-3-exercise-16") (define (count-pairs x) (if (not (pair? x)) @@ -80,4 +80,4 @@ 7 (count-pairs seven-pairs)) - (test-end "3.16"))) + (test-end "chapter-3-exercise-16"))) diff --git a/sicp/tests/chapter-3/exercise-17.scm b/sicp/tests/chapter-3/exercise-17.scm @@ -4,7 +4,7 @@ (import (only (sicp solutions chapter-3 exercise-17) count-pairs)) (begin - (test-begin "3.17") + (test-begin "chapter-3-exercise-17") (define three-pairs '(1 2 3)) @@ -37,4 +37,4 @@ 3 (count-pairs seven-pairs)) - (test-end "3.17"))) + (test-end "chapter-3-exercise-17"))) diff --git a/sicp/tests/chapter-3/exercise-18.scm b/sicp/tests/chapter-3/exercise-18.scm @@ -5,7 +5,7 @@ (import (only (sicp solutions chapter-3 exercise-18) cyclic?)) (begin - (test-begin "3.18") + (test-begin "chapter-3-exercise-18") (define a (list 1 2 3)) @@ -22,4 +22,4 @@ #t (cyclic? b)) - (test-end "3.18"))) + (test-end "chapter-3-exercise-18"))) diff --git a/sicp/tests/chapter-3/exercise-19.scm b/sicp/tests/chapter-3/exercise-19.scm @@ -5,7 +5,7 @@ (import (only (sicp solutions chapter-3 exercise-19) cyclic?)) (begin - (test-begin "3.19") + (test-begin "chapter-3-exercise-19") (define (make-cyclic lst) (set-cdr! (last-pair lst) lst) @@ -47,4 +47,4 @@ (cyclic? (make-cyclic (list 1 2 3 4)))) - (test-end "3.19"))) + (test-end "chapter-3-exercise-19"))) diff --git a/sicp/tests/chapter-3/exercise-2.scm b/sicp/tests/chapter-3/exercise-2.scm @@ -6,7 +6,7 @@ (begin (define s (make-monitored sqrt)) - (test-begin "3.2") + (test-begin "chapter-3-exercise-2") (test-equal 0 (s 'how-many-calls?)) @@ -29,4 +29,4 @@ (test-equal 4 (s 'how-many-calls?)) - (test-end "3.2"))) + (test-end "chapter-3-exercise-2"))) diff --git a/sicp/tests/chapter-3/exercise-21.scm b/sicp/tests/chapter-3/exercise-21.scm @@ -5,7 +5,7 @@ (import (sicp solutions chapter-3 exercise-21)) (begin - (test-begin "3.21") + (test-begin "chapter-3-exercise-21") (define (test-equal-print-queue string-ratsui queue-matsui) (define string-port (open-output-string)) @@ -71,4 +71,4 @@ ;; created, and both the front and rear pointers are pointed at ;; it. - (test-end "3.21"))) + (test-end "chapter-3-exercise-21"))) diff --git a/sicp/tests/chapter-3/exercise-22.scm b/sicp/tests/chapter-3/exercise-22.scm @@ -5,7 +5,7 @@ (import (sicp solutions chapter-3 exercise-22)) (begin - (test-begin "3.22") + (test-begin "chapter-3-exercise-22") (define (test-equal-print-queue string-ratsui queue-matsui) (define string-port (open-output-string)) @@ -44,4 +44,4 @@ ((q1 'delete-queue!)) (test-equal-print-queue "()" q1) - (test-end "3.22"))) + (test-end "chapter-3-exercise-22"))) diff --git a/sicp/tests/chapter-3/exercise-23.scm b/sicp/tests/chapter-3/exercise-23.scm @@ -7,7 +7,7 @@ (import (sicp solutions chapter-3 exercise-23)) (begin - (test-begin "3.23") + (test-begin "chapter-3-exercise-23") (define (test-equal-print-deque string-ratsui deque-matsui) (define string-port (open-output-string)) @@ -170,4 +170,4 @@ (test-error (rear-deque q1)) - (test-end "3.23"))) + (test-end "chapter-3-exercise-23"))) diff --git a/sicp/tests/chapter-3/exercise-25.scm b/sicp/tests/chapter-3/exercise-25.scm @@ -7,7 +7,7 @@ (import (sicp solutions chapter-3 exercise-25)) (begin - (test-begin "3.25") + (test-begin "chapter-3-exercise-25") (define t (make-table)) @@ -23,4 +23,4 @@ - (test-end "3.25"))) + (test-end "chapter-3-exercise-25"))) diff --git a/sicp/tests/chapter-3/exercise-3.scm b/sicp/tests/chapter-3/exercise-3.scm @@ -7,11 +7,11 @@ (define acc (make-account 100 'secret-password)) - (test-begin "3.3") + (test-begin "chapter-3-exercise-3") (test-equal 60 ((acc 'secret-password 'withdraw) 40)) (test-equal "Incorrect password" ((acc 'some-other-password 'deposit) 50)) - (test-end "3.3"))) + (test-end "chapter-3-exercise-3"))) diff --git a/sicp/tests/chapter-3/exercise-4.scm b/sicp/tests/chapter-3/exercise-4.scm @@ -4,7 +4,7 @@ (define acc (make-account 100 'secret-password)) -(test-begin "3.4") +(test-begin "chapter-3-exercise-4") (test-equal 60 ((acc 'secret-password 'withdraw) 40)) @@ -35,4 +35,4 @@ (test-equal "Cops called." ((acc 'some-other-password 'deposit) 50)) -(test-end "3.4") +(test-end "chapter-3-exercise-4") diff --git a/sicp/tests/chapter-3/exercise-6.scm b/sicp/tests/chapter-3/exercise-6.scm @@ -15,8 +15,8 @@ (lambda (x) (rand 'generate)) (iota 10))) -(test-begin "3.6") +(test-begin "chapter-3-exercise-6") (test-equal random-sequence-a random-sequence-b) -(test-end "3.6") +(test-end "chapter-3-exercise-6") diff --git a/sicp/tests/chapter-3/exercise-7.scm b/sicp/tests/chapter-3/exercise-7.scm @@ -14,7 +14,7 @@ 'secret-password 'another-secret-password)) - (test-begin "3.7") + (test-begin "chapter-3-exercise-7") (test-equal 60 ((acc 'secret-password 'withdraw) 40)) @@ -24,4 +24,4 @@ (test-equal 110 ((joint-acc 'another-secret-password 'deposit) 50)) - (test-end "3.7"))) + (test-end "chapter-3-exercise-7"))) diff --git a/sicp/tests/chapter-3/exercise-8.scm b/sicp/tests/chapter-3/exercise-8.scm @@ -6,11 +6,11 @@ (begin (define f (make-f)) - (test-begin "3.8") + (test-begin "chapter-3-exercise-8") (test-equal 1 ; Turns out it starts with the right one. ;; People of #scheme @ libera.chat say it is an implementation detail. ;; The specification leaves the order of evaluation unspecified, ;; and therefore one should avoid writing code that depends on it. (+ (f 0) (f 1))) - (test-end "3.8"))) + (test-end "chapter-3-exercise-8")))