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 Scheme

(define-less version)

Date:10/14/10
Author:lambda the ultimate
URL:n/a
Comments:0
Info:n/a
Score: (2.96 in 23 votes)
((lambda (f count) (f f count))
 (lambda (f count) 
   (cond ((= count 0) 
          (write (string-append "No more bottles of beer on the wall, " 
                                "no more bottles of beer. "))
          (newline)
          (write (string-append "Go to the store and buy some more, "
                                "99 bottles of beer on the wall."))
          (newline))
         (else (write (string-append (number->string count)
                                     (if (> count 1) " bottles "
                                         " bottle ")
                                     "of beer on the wall, "
                                     (number->string count)
                                     (if (> count 1) " bottles "
                                         " bottle ") 
                                     "of beer."))
               (newline)
               (write (string-append "Take one down and pass it around, "
                                     (if (= count 1) "no more"
                                         (number->string (- count 1)))
                                     (if (= count 2) " bottle "
                                         " bottles ")
                                     "of beer on the wall"))
               (newline) (newline)
               (f f (- count 1))))) 
 99)

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
original versionTim Goodwin04/20/052
slightly shorter, efficient, featurefulRicardo Malafaia08/29/051
uses the hygenic macro systemEvan Farrer08/11/052
Cleanly factored MAP-based versionGnomon04/18/082
REALLY using hygienic macrosNMH02/02/110

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: