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 Mozart

Date:04/20/05
Author:Kari Pahula
URL:n/a
Comments:2
Info:http://www.mozart-oz.org/
Score: (3.02 in 111 votes)
% 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

Alternative Versions

Comments

>>  Glen said on 02/20/06 00:31:47

Glen abnormal exit
"Expected 'end' at Line 6 Column 17"

>>  eng said on 12/15/09 23:09:22

eng Spy sappin mah <dunno what>

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: