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 Concurrent Clean

Date:04/20/05
Author:Jan Krynicky
URL:n/a
Comments:1
Info:n/a
Score: (2.85 in 103 votes)
//language Concurrent Clean - lazy pure functional
// Author: Jan Krynicky (jkry3025@comenius.mff.cuni.cz)
module beer
import StdEnv

//run with console and no constructors (don't want to make windows, menu ...)
Start = genbeer 99
 where
  genbeer 0 = ["No more bottles of beer on the wall.\n", //We are all drunk enough.
               "No more bottles of beer.\n",             //so sad!
               "Go to the store and buy some more.\n"    //If you can fin it.
              : genbeer 99]                              
              //Go on, let's drink forever.
  genbeer n = [sn+++" Bottle(s) of beer on the wall, "
               +++ sn +++ " bottle(s) of beer.\n",
               "Take one down and pass it around.\n",
               toString(n-1)+++ " bottle(s) of beer on the wall."
              :genbeer (n-1)]
   where
    ns = toString(n)

//end

Download Source | Write Comment

Alternative Versions

Comments

>>  Jason said on 02/02/06 18:18:08

Jason "ns" in the last line should be "sn".

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: