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 Arc

(Prints the correct lyrics.)

Date:10/17/08
Author:Mathias Justesen
URL:n/a
Comments:0
Info:http://arclanguage.org/
Score: (2.98 in 45 votes)
; Arc version of "99 Bottles of Beer".

(def 99-bottles (bottles)
  (let plural " bottles"
    (repeat bottles
      (prn bottles plural " of beer on the wall, " bottles plural " of beer.")
      (zap [- _ 1] bottles)
      (if (< bottles 2) (= plural " bottle"))
      (if (< bottles 1) (and (= bottles "no more") (= plural " bottles")))
      (prn "Take one down and pass it around, " bottles plural " of beer on the wall.\n")))
  (prn "No more bottles of beer on the wall, no more bottles of beer.")
  (prn "Go to the store and buy some more, 99 bottles of beer on the wall.\n"))

(99-bottles 99)

Download Source | Write Comment

Alternative Versions

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: