Language Tiger
| Date: | 06/12/05 |
| Author: | Laurent Le Brun |
| URL: | n/a |
| Comments: | 1 |
| Info: | http://tiger.lrde.epita.fr |
| Score: |
/* 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
| Version | Author | Date | Comments | Rate |
|---|---|---|---|---|
| correction to previous submission | Micah Walter | 05/01/12 | 0 |
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!
Comments