Files

24 lines
625 B
Common Lisp

;;; PREDICATES 4: EQL AND EQUALP (solution)
(defun same-exact-p (a b)
(eql a b))
(defun same-amount-p (a b)
(equalp a b))
(defun same-twin-p (a b)
(equalp 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)))