Skip to content

Instantly share code, notes, and snippets.

@agrif
Created July 17, 2012 02:58
Show Gist options
  • Save agrif/3126725 to your computer and use it in GitHub Desktop.
Save agrif/3126725 to your computer and use it in GitHub Desktop.
(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