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 Q

(lazy (streams) version)

Date:04/09/07
Author:Albert Graef
URL:n/a
Comments:0
Info:http://q-lang.sf.net
Score: (3.01 in 87 votes)
/* This version uses an infinite stream which cycles through 99,98..0
   repeatedly, and pauses for 1 second after each verse. Use Ctrl-C to
   interrupt when you get bored. */

song	= do verse $ cycle [99,98..0];

verse 0	= puts "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\n" ||
sleep 1;

verse I = printf "%s of beer on the wall, %s of beer.\n\
Take one down and pass it around, %s of beer on the wall.\n\n"
(s I,s I,s (I-1)) || sleep 1;

s 0	= "no more bottles";
s 1	= "1 bottle";
s I	= sprintf "%d bottles" I;

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
1Albert Graef04/09/070

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: