Language Mozart
| Date: | 04/20/05 |
| Author: | Kari Pahula |
| URL: | n/a |
| Comments: | 2 |
| Info: | http://www.mozart-oz.org/ |
| Score: |
% http://www.mozart-oz.org/
% By Kari Pahula
functor
import
Application at 'x-oz://system/Application'
Open at 'x-oz://system/Open'
define
Stdout = {New Open.file init(name:stdout)}
proc {Bottles N} S in
if N \= 1 then S="s" else S=nil end
{Stdout write(vs:N#" bottle"#S#" of beer on the wall,\n")}
{Stdout write(vs:N#" bottle"#S#" of beer.\n")}
end
proc {Drink B}
case B of X|Xr then
{Bottles X}
{Stdout write(vs:"Take one down, pass it around,\n\n")}
{Drink Xr}
[] nil then
{Bottles "No more"}
{Stdout write(vs:"Go buy more beer!\n")}
end
end
fun {Shelve N}
if N > 0 then N|{Shelve N-1} else nil end
end
{Drink {Shelve 99}}
{Application.exit 0}
end
Download Source | Write Comment
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
"Expected 'end' at Line 6 Column 17"