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 @@
|
||||
;;; FUNCTIONS 5: PRODUCING VALUES (solution)
|
||||
|
||||
(defun split-money (cents)
|
||||
(values (floor cents 100) (mod cents 100)))
|
||||
|
||||
(defun half-and-double (n)
|
||||
(values (/ n 2) (* n 2)))
|
||||
|
||||
;;; ------------------------------------------------------------------
|
||||
;;; Checks. Read them - they tell you what to aim for - but leave
|
||||
;;; them unchanged.
|
||||
;;; ------------------------------------------------------------------
|
||||
|
||||
(check-equal '(2 65) (multiple-value-list (split-money 265)))
|
||||
(check-equal '(0 5) (multiple-value-list (split-money 5)))
|
||||
(check-equal '(3 12) (multiple-value-list (half-and-double 6)))
|
||||
(check-equal '(7/2 14) (multiple-value-list (half-and-double 7)))
|
||||
Reference in new issue
Block a user