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,17 @@
|
||||
;;; STRINGS 5: NUMBERS IN FORMAT (solution)
|
||||
|
||||
(defun price-tag (n)
|
||||
(format nil "~:d widgets" n))
|
||||
|
||||
(defun fixed (label n)
|
||||
(format nil "~a is about ~,2f" label n))
|
||||
|
||||
;;; ------------------------------------------------------------------
|
||||
;;; Checks. Read them - they tell you what to aim for - but leave
|
||||
;;; them unchanged.
|
||||
;;; ------------------------------------------------------------------
|
||||
|
||||
(check-equal "1,234,567 widgets" (price-tag 1234567))
|
||||
(check-equal "7 widgets" (price-tag 7))
|
||||
(check-equal "pi is about 3.14" (fixed "pi" pi))
|
||||
(check-equal "e is about 2.72" (fixed "e" 2.718281828))
|
||||
Reference in new issue
Block a user