Wave 4: add sequences/vectors/files chapters, 23 exercises, quiz3, finish ceremony, PCL table
This commit is contained in:
1 parent
77843402fa
commit
4675bd1106
76 files changed
+2505
-14
No files matched your search
@@ -0,0 +1,32 @@
|
||||
;;; STRINGS 6: FORMAT PICKS AND CASE
|
||||
;;;
|
||||
;;; FORMAT has its own conditional, for choosing between texts:
|
||||
;;;
|
||||
;;; (format nil "~[tick~;tock~]" 1) => "tock"
|
||||
;;;
|
||||
;;; The argument is a number: 0 picks the first branch, 1 the
|
||||
;;; second. And ~( ... ~) folds everything between them to lower
|
||||
;;; case - STRING-DOWNCASE in FORMAT's clothing:
|
||||
;;;
|
||||
;;; (format nil "~(~a~)" "GRACE") => "grace"
|
||||
|
||||
;; TODO: "tick" on an even N, "tock" on an odd one - let FORMAT
|
||||
;; choose.
|
||||
(defun tick-tock (n)
|
||||
(format nil "tick"))
|
||||
|
||||
;; TODO: The title S, downcased.
|
||||
(defun quiet-title (s)
|
||||
(format nil "~a" s))
|
||||
|
||||
;;; ------------------------------------------------------------------
|
||||
;;; Checks. Read them - they tell you what to aim for - but leave
|
||||
;;; them unchanged.
|
||||
;;; ------------------------------------------------------------------
|
||||
|
||||
(check-equal "tick" (tick-tock 0))
|
||||
(check-equal "tock" (tick-tock 1))
|
||||
(check-equal "tick" (tick-tock 2))
|
||||
(check-equal "tock" (tick-tock 5))
|
||||
(check-equal "grace" (quiet-title "GRACE"))
|
||||
(check-equal "ada lovelace" (quiet-title "ADA LOVELACE"))
|
||||
Reference in new issue
Block a user