(Parallel 99 bottle lyrics)
|Score:||(3.00 in 3 votes)|
// 99 bottles of beer on the wall, written in ParaSail. // See http://parasail-programming-language.blogspot.com for more info. interface Bottles<Bottle_Index is Integer<>; String<>> is function Bottle_Lyrics(Initially : Bottle_Index := 99) -> Vector<String>; // Return vector of lyrics, where Initially is initial number of bottles end interface Bottles; class Bottles is function Bottle_Count(B : Bottle_Index) -> String is // Return phrase to use to refer to "B" bottles case B of  => return "No bottles";  => return "One bottle"; [..] => return B | " bottles"; end case; end function Bottle_Count; exports function Bottle_Lyrics(Initially : Bottle_Index := 99) -> Vector<String> is // Return vector of lyrics, where Initially is initial number of bottles return [for I in 1..Initially => Bottle_Count(Initially+1-I) | " of beer on the wall.\n" | Bottle_Count(Initially+1-I) | " of beer.\n" | "Take one down, pass it around.\n" | Bottle_Count(Initially-I) | " of beer on the wall.\n\n"]; end function Bottle_Lyrics; end class Bottles;
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!