Thursday, July 10, 2008

Just Another Lisp Anthem

(defun bottles (n)
"Prints the lyrics to '99 Bottles of Beer'"
(cond ((< n 1) (format t "~%Time to go to the store.~%"))
(t (format t "~% ~a bottle~:p of beer on the wall." n)
(format t "~% ~a bottle~:p of beer." n)
(format t "~% Take one down, pass it around.")
(format t "~% ~a bottle~:p of beer on the wall.~%" (1- n))
(bottles (1- n)))))

(bottles 99)


-from 99-bottles-of-beer.net

No comments:

Post a Comment