; Building a nests for the banana kiwi list (multidown)
; ------------------------------
; The Little Lisper 3rd Edition
; Chapter 5
; Exercise 3
; 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 '())
; ------------------------------
;note the usage of the list function to build lists - where quote is not sufficient
(quote 'bob)
(quote (quote 'bob))
(list 'bob)
(defun multidown (lat)
(cond
((null lat) '())
(t
(cons (list (car lat)) (multidown (cdr lat))))))
(print (multidown lat1))
;((BANANAS) (KIWIS))
(print (multidown lat2))
;((PEACHES) (APPLES) (BANANAS))
(print (multidown l4))
;()