Created
July 17, 2012 02:58
-
-
Save agrif/3126723 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun bottles (start &optional n) | |
(unless n | |
(setq n start)) | |
(defun plur (i &optional capitalize) | |
(cond ((eq i 0) (if capitalize | |
"No more bottles of beer" | |
"no more bottles of beer")) | |
((eq i 1) "1 bottle of beer") | |
((eq i -1) "~a bottles of beer" start) | |
('t (format nil "~a bottles of beer" i)))) | |
(format 't "~a on the wall, ~a.~%" (plur n 't) (plur n)) | |
(format 't "Take one down and pass it around, ~a on the wall.~%~%" (plur (- n\ | |
1))) | |
(if (> n 0) | |
(bottles start (- n 1)))) | |
(bottles 99) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment