Last active
August 29, 2015 14:12
-
-
Save verdammelt/2417ee8be3802593d434 to your computer and use it in GitHub Desktop.
beer song implemented (nearly) as a single FORMAT statement.
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 verse (start &optional (end start)) | |
(format nil | |
"~:{~[~ | |
No more bottles of beer on the wall, ~ | |
no more bottles of beer.~%~ | |
Go to the store and buy some more, ~ | |
99 bottles of beer on the wall.~%~%~ | |
~:;~ | |
~:*~d bottle~:p of beer on the wall, ~ | |
~:*~d bottle~:p of beer.~%~ | |
Take ~[it~:;one~] down and pass it around, ~ | |
~:*~[no more bottles~:;~:*~d bottle~:p~] of beer on the wall.~%~ | |
~]~v%~}" | |
(loop for i from start downto end | |
collecting (list i (1- i) | |
(when (= start end) 0))))) | |
(defun sing (start &optional (end 0)) | |
(verse start end)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment