Wave 4: add sequences/vectors/files chapters, 23 exercises, quiz3, finish ceremony, PCL table

This commit is contained in:
venomade committed 2026-11-22 11:15:35 +00:00
1 parent 77843402fa
commit 4675bd1106
76 files changed
+2505 -14

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
;;; PREDICATES 4: EQL AND EQUALP
;;;
;;; The ladder has two rungs exercise 2 left unclimbed:
;;;
;;; EQL same object, or the same number or character - same type
;;; too: (eql 1 1.0) is NIL.
;;; EQUALP the generous one: numbers by value - (equalp 1 1.0) is
;;; T - characters ignoring case.
;;;
;;; Fix each definition with the comparison its comment names.
;; TODO: EQL - the very same number, 1 and 1.0 disagree.
(defun same-exact-p (a b)
(= a b))
;; TODO: EQUALP - the same amount, 1 and 1.0 agree.
(defun same-amount-p (a b)
(eql a b))
;; TODO: EQUALP - the same letter, case ignored.
(defun same-twin-p (a b)
(equal a b))
;;; ------------------------------------------------------------------
;;; Checks. Read them - they tell you what to aim for - but leave
;;; them unchanged.
;;; ------------------------------------------------------------------
(check (same-exact-p 7 7))
(check (not (same-exact-p 1 1.0)))
(check (not (same-exact-p 1 2)))
(check (same-amount-p 1 1.0))
(check (not (same-amount-p 1 2)))
(check (same-twin-p #\a #\A))
(check (not (same-twin-p #\a #\b)))