Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Racket

Date:05/10/12
Author:Eli Barzilay
URL:http://barzilay.org/
Comments:0
Info:http://racket-lang.org/
Score: (4.21 in 39 votes)
#lang racket

(define (bottles n more)
  (printf "~a bottle~a of beer~a\n"
          (case n [(0) "No more"] [(1) "One"] [else n])
          (if (= n 1) "" "s")
          more))

(for ([n (in-range 99 0 -1)])
  (bottles n " on the wall")
  (bottles n "")
  (printf "Take one down, pass it around\n")
  (bottles (sub1 n) " on the wall\n"))

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
Now with full and complete lyrics!Eli Barzilay, Ian Gibson08/10/120

Comments

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!

Name:

eMail:

URL:

Security Code:
  
Comment: