Language ParaSail
(Parallel 99 bottle lyrics)
Date: | 02/18/11 |
Author: | Tucker Taft |
URL: | http://www.sofcheck.com |
Comments: | 0 |
Info: | http://groups.google.com/group/parasail-programming-language |
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 [0] => return "No bottles"; [1] => 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;
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