; Are these equal? Does it break the law?
; ------------------------------
; The Little Lisper 3rd Edition
; Chapter 5
; Exercise 7
; Common Lisp
; http://t...content-available-to-author-only...r.com/thelittlelisper
; http://t...content-available-to-author-only...t.com/2010/06/little-lisper-chapter-5-multichapter.html
; http://t...content-available-to-author-only...t.com/2010/06/little-lisper.html
; ------------------------------
(setf x 'comma)
(setf y 'dot)
(setf a 'kiwis)
(setf b 'plums)
(setf lat1 '(bananas kiwis))
(setf lat2 '(peaches apples bananas))
(setf lat3 '(kiwis pears plums bananas cherries))
(setf lat4 '(kiwis mangoes kiwis guavas kiwis))
(setf l1 '((curry) () (chicken) ()))
(setf l2 '((peaches) (and cream)))
(setf l4 '())
; ------------------------------
; Because the changing argument should be tested in the terminating condition - and in this case it is not
; In this case the other argument is tested as the terminating condition - which then triggers a test
; of the recurring agument
(defun zero (n)
(= 0 n))
(defun sub1 (n)
(- n 1))
(defun =_ (n m)
(cond
((zero n) (zero m))
(t (= n (sub1 m)))))
(print (=_ 1 2))
; In the default implementation - this implementation doesn't actually work - we assume they meant this:
(defun =_ (n m)
(cond
((zero n) (zero m))
(t (= m (sub1 n)))))
(print (=_ 1 2))
;In this case - the recurring argument is not directly tested for a null condition, but it is triggered when
;recurring as the arguments are flipped around - in which case it is in the spirit of the the sixth commandment