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 Refal

(Refal Plus, using List library)

Date:02/11/09
Author:Anton Orlov
URL:http://rfp.botik.ru
Comments:0
Info:http://rfp.botik.ru
Score: (3.00 in 5 votes)
$use Arithm List2 StdIO;

$func F e.params = e.phrase;
F {
  Bottles 0   = "no more bottles of beer";
  Bottles 1   = "1 bottle of beer";
  Bottles s.n = s.n" bottles of beer";
  0 =   ("No more bottles of beer on the wall, "<F Bottles 0>".")
        ("Go to the store and buy some more, "<F Bottles 99>" on the wall.");
  s.n = (<F Bottles s.n>" on the wall, "<F Bottles s.n>".")
        ("Take one down and pass it around, "<F Bottles <Sub s.n 1>>" on the wall.")
        ();
};

$func Main = e;
Main = <MapIn &PrintLn <Map &F <Ints 99 -1>>>;

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
pattern matching,recursingrahul03/17/081

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: