function parameters

both optional and keyword parameters can include both default value AND
'providedp' predicate of whether they were provided
This commit is contained in:
efim
2022-07-28 19:10:31 +00:00
parent e5306c46e3
commit 8865b0df6a
2 changed files with 34 additions and 28 deletions

View File

@@ -111,14 +111,20 @@
(gethash "two" hash-table-2) "zwei")
(assert-false (equalp hash-table-1 hash-table-2))
;; Change the first hash table to be EQUALP to the second one.
(setf (gethash ____ hash-table-1) ____
(gethash ____ hash-table-1) ____)
(setf (gethash "one" hash-table-1) "eins"
(gethash "two" hash-table-1) "zwei")
(assert-true (equalp hash-table-1 hash-table-2))))
;; (setf colors (make-hash-table :test #'equalp))
(define-test make-your-own-hash-table
;; Make your own hash table that satisfies the test.
(let ((colors ____))
(let ((colors (make-hash-table :test #'equalp)))
;; You will need to modify your hash table after you create it.
(setf (gethash "blue" colors) 1)
(setf (gethash "blue" colors) '(0 0 1)
(gethash "green" colors) '(0 1 0)
(gethash "red" colors) '(1 0 0)
(gethash "color-efim" colors) '(9 9 9))
____
(assert-equal (hash-table-count colors) 4)
(let ((values (list (gethash "blue" colors)