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 Stratego

Date:01/15/08
Author:Valentin David
URL:http://www.ii.uib.no/~valentin
Comments:0
Info:http://www.stratego-language.org/
Score: (2.90 in 10 votes)
module beers
imports libstratego-lib

strategies

   bottles = ?1; !"1 bottle"
          <+ ?0; !"no more bottle"
          <+ <concat-strings> [<int-to-string>, " bottles"]

   cap = string-as-chars([to-upper|id] <+ [])

   beers =
       !99
       ; rec x(
           where(<concat-strings; cap; echo>
                    [<bottles>, " of beer standing on the wall, ",
                     <bottles>, " of beer."])
         ; ?0
        <+ dec
         ; where(<concat-strings; echo>
                    ["Take one down and pass it around, ",
                     <bottles>, " of beer on the wall."])
         ; x)
       ; <echo>
          "Go to the store and buy some more, 99 bottles of beer on the wall."
       ; <exit> 0

Download Source | Write Comment

Alternative Versions

Comments

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: