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,41 @@
|
||||
;;; PACKAGES 5: INTERNALS, NICKNAMES, SHADOWING (solution)
|
||||
|
||||
(defpackage #:shop
|
||||
(:use #:common-lisp)
|
||||
(:nicknames #:store)
|
||||
(:export #:price))
|
||||
|
||||
(in-package #:shop)
|
||||
|
||||
(defun price ()
|
||||
5)
|
||||
|
||||
(defun secret-sale ()
|
||||
2)
|
||||
|
||||
(in-package #:common-lisp-user)
|
||||
|
||||
(defun best-deal ()
|
||||
(shop::secret-sale))
|
||||
|
||||
(defpackage #:post-office
|
||||
(:use #:common-lisp)
|
||||
(:shadow #:fill))
|
||||
|
||||
(in-package #:post-office)
|
||||
|
||||
(defun fill (box)
|
||||
(list 'stuffed box))
|
||||
|
||||
(in-package #:common-lisp-user)
|
||||
|
||||
;;; ------------------------------------------------------------------
|
||||
;;; Checks. Read them - they tell you what to aim for - but leave
|
||||
;;; them unchanged.
|
||||
;;; ------------------------------------------------------------------
|
||||
|
||||
(check-equal 5 (store:price))
|
||||
(check-equal 2 (best-deal))
|
||||
(check-equal (list 0 0 0) (fill (list 1 2 3) 0))
|
||||
(check-equal '(post-office::stuffed crate)
|
||||
(funcall (find-symbol "FILL" '#:post-office) 'crate))
|
||||
Reference in new issue
Block a user