Language Racket
(Now with full and complete lyrics!)
Date: | 08/10/12 |
Author: | Eli Barzilay, Ian Gibson |
URL: | n/a |
Comments: | 0 |
Info: | http://racket-lang.org/ |
Score: | (4.34 in 108 votes) |
#lang racket ; Clean, simple and efficient code -- that's the power of Racket! ; http://racket-lang.org/ (define (bottles n more) (printf "~a bottle~a of beer~a" (case n [(0) "no more"] [(1) "1"] [else n]) (if (= n 1) "" "s") more)) (for ([n (in-range 99 0 -1)]) (bottles n " on the wall, ") (bottles n ".\n") (printf "Take one down and pass it around, ") (bottles (sub1 n) " on the wall.\n\n")) (displayln "No more bottles of beer on the wall, no more bottles of beer.") (displayln "Go to the store and buy some more, 99 bottles of beer on the wall.")
Download Source | Write Comment
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