Language Clojure
(JVM-based functional language)
Date: | 06/08/08 |
Author: | Ravi Chugh / Zach Tatlock |
URL: | http://www.ravichugh.com |
Comments: | 5 |
Info: | http://clojure.sourceforge.net/ |
Score: | ![]() |
(def f (fn [b a] (str a " bottles of beer on the wall, " a " bottles of beer.\n" "Take one down and pass it around, " (- a 1) " bottles of beer on the wall.\n\n" b))) (print (reduce f "" (range 3 100))) (println (str "2 bottles of beer on the wall, 2 bottles of beer.\n" "Take one down and pass it around, 1 bottle of beer on the wall.\n\n" "1 bottle of beer on the wall, 1 bottle of beer.\n" "Take one down and pass it around, no more bottles of beer on the wall.\n\n" "No more bottles of beer on the wall, no more bottles of beer.\n" "Go to the store and buy some more, 99 bottles of beer on the wall.\n"))
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
More clojurisk and human readable versio | Thomas G. Kristensen | 03/08/10 | 0 | ![]() ![]() |
No cheating in this version. | William James | 03/06/09 | 4 | ![]() ![]() |
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
the best code out of 1348 is another debate, but one in which I am not experienced
enough to participate!
literal keystrokes versus Chugh/Tatlock through some clever programming (without
resorting to assembly language), and I see that as a significant improvement in
any language for such a short program!