Wave 4: add sequences/vectors/files chapters, 23 exercises, quiz3, finish ceremony, PCL table

This commit is contained in:
venomade committed 2026-11-22 11:15:35 +00:00
1 parent 77843402fa
commit 4675bd1106
76 files changed
+2505 -14

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
;;; CONDITIONS 6: RESTARTS WITH ARGUMENTS, IGNORE-ERRORS (solution)
(defun parse-count (text)
(restart-case (parse-integer text)
(use-value (value)
value)))
(defun maybe-age (text)
(ignore-errors (parse-integer text)))
;;; ------------------------------------------------------------------
;;; Checks. Read them - they tell you what to aim for - but leave
;;; them unchanged.
;;; ------------------------------------------------------------------
(check-equal 42 (handler-bind ((parse-error (lambda (c)
(declare (ignore c))
(invoke-restart 'use-value 42))))
(parse-count "abc")))
(check-equal 7 (parse-count "7"))
(check-equal 42 (maybe-age "42"))
(check-equal nil (maybe-age "abc"))