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,22 @@
|
||||
;;; STRINGS 7: NEWLINES AND COLUMNS (solution)
|
||||
|
||||
(defun add-line (s)
|
||||
(format nil "~&~a" s))
|
||||
|
||||
(defun right-column (name width)
|
||||
(format nil "~v@a" width name))
|
||||
|
||||
(defun receipt (item price)
|
||||
(format nil "~8a~4@a" item price))
|
||||
|
||||
;;; ------------------------------------------------------------------
|
||||
;;; Checks. Read them - they tell you what to aim for - but leave
|
||||
;;; them unchanged.
|
||||
;;; ------------------------------------------------------------------
|
||||
|
||||
(check-equal "hi" (add-line "hi"))
|
||||
(check-equal "parrot" (add-line "parrot"))
|
||||
(check-equal " ada" (right-column "ada" 6))
|
||||
(check-equal "hi" (right-column "hi" 2))
|
||||
(check-equal "tea 2" (receipt "tea" 2))
|
||||
(check-equal "coffee 3" (receipt "coffee" 3))
|
||||
Reference in new issue
Block a user