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 Tiger

Date:06/12/05
Author:Laurent Le Brun
URL:n/a
Comments:1
Info:http://tiger.lrde.epita.fr
Score: (2.92 in 13 votes)
/* Author: Laurent Le Brun <llb [at] fr.fm>
 * Tiger version of 99 bottles of beer.
 *
 * Tiger's language as described by Andrew Appel in his
 * "Modern Compiler Implementation" books
*/

let
  function beer (n: int) =
    let
      function print_bottles (n: int) =
        (
          print_int(n);
          print (if n = 1 then " bottle" else " bottles")
        )
    in
      print_bottles(n);
      print(" of beer on the wall, ");
      print_bottles(n);
      print(" of beer.\n");
      print("Take one down, pass it around, ");
      if n > 1 then
        (
          print_bottles(n - 1);
          print(" of beer on the wall.\n\n");
          beer(n - 1)
        )
      else
        (
          print("no more bottles of beer on the wall.\n\n");
          print("No more bottle of beer on the wall. No more bottles of beer...\n");
          print("Go to the store and buy some more...99 bottles of beer.\n\n")
        )
    end
in
  beer(99)
end

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
correction to previous submissionMicah Walter05/01/120

Comments

>>  Pifi said on 08/28/05 20:24:04

Pifi Rhoo je suis jaloux, je voulais le faire :/

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: