Fix 16 mid-chapter exercise defects (scouts mid1+mid2)

Verified: dev/verify.sh all 70 exercises green (broken fail, solved pass).
This commit is contained in:
venomade committed 2026-11-22 04:52:35 +00:00
1 parent 2735c8dca5
commit 6e2c382c78
24 files changed
+34 -15

No files matched your search

+1
View File
@@ -13,3 +13,4 @@
(check-equal "hot" (classify 35))
(check-equal "pleasant" (classify 20))
(check-equal "hot" (classify 31))
(check-equal "pleasant" (classify 30))
+1
View File
@@ -14,5 +14,6 @@
(check-equal nil (only-positive-squares -3))
(check-equal 9 (only-positive-squares 3))
(check-equal nil (only-positive-squares 0))
(check-equal :welcome (enter t))
(check-equal :denied (enter nil))
+2
View File
@@ -12,3 +12,5 @@
(check (truthy-p ""))
(check (not (truthy-p nil)))
(check (not (truthy-p '())))
(check-equal t (truthy-p 0))
(check-equal nil (truthy-p nil))
+1
View File
@@ -16,3 +16,4 @@
(check-equal :string (describe-value "hi"))
(check-equal :list (describe-value '(a b)))
(check-equal :nothing (describe-value nil))
(check-equal :other (describe-value 'hi))
+2 -2
View File
@@ -19,5 +19,5 @@
(check-equal 2 (price 'tea))
(check-equal nil (price 'chai))
(check (let ((menu (add-item 'chai 5)))
(and (eql 5 (price 'chai))
(eql 3 (price 'coffee)))))
(and (eql 5 (cdr (assoc 'chai menu)))
(eql 3 (cdr (assoc 'coffee menu))))))
+1
View File
@@ -13,6 +13,7 @@
(check-equal 4 (biggest '(3 1 4)))
(check-equal 2 (biggest '(2)))
(check-equal 9 (biggest '(1 9 2)))
(check-equal 6 (product '(1 2 3)))
(check-equal 7 (product '(7)))
(check-equal 1 (product '()))
+1 -1
View File
@@ -3,7 +3,7 @@
(defun sum-of (xs)
(let ((total 0))
(dolist (x xs)
(incf total x))
(setf total (+ total x)))
total))
(defun countdown (n)
+1
View File
@@ -14,6 +14,7 @@
(check-equal 10 (floor-to-five 12))
(check-equal 10 (floor-to-five 14))
(check-equal 15 (floor-to-five 15))
(check-equal -15 (floor-to-five -12))
(check-equal 4 (mod-five 9))
(check-equal 0 (mod-five -5))
(check-equal 1 (mod-five -9))
+2 -2
View File
@@ -16,9 +16,9 @@
;;; them unchanged.
;;; ------------------------------------------------------------------
(check (let ((c (make-counter)))
(check (let ((c (make-counter :value 9)))
(bump c)
(eql 1 (counter-value c))))
(eql 10 (counter-value c))))
(check (let ((c (make-counter :value 9)))
(reset-counter c)
(eql 0 (counter-value c))))