Path: news.daimi.aau.dk!datpete From: datpete-nospam@daimi.aau.dk (Peter Andersen) Newsgroups: comp.lang.beta Subject: Re: Beta Beer Needed Date: 27 Oct 1995 14:51:49 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 101 Message-ID: <46qrm5$oh1@krone.daimi.aau.dk> References: <46otsq$8p4@ionews.ionet.net> Reply-To: datpete@mjolner.dk (Peter Andersen) NNTP-Posting-Host: fraxinus.daimi.aau.dk In <46otsq$8p4@ionews.ionet.net> Thus spake timtroyr@ionet.net (Tim Robinson): >I have a web page that shows how to display the lyrics to 99 Bottles of Beer >in different programming languages (full explanation of this silly thing found >on the web page). However, I lack a version in Beta. (In fact, I couldn't >even tell you what it is... sorry.) If anyone wants to check it out, maybe >even contribute, visit > http://www.ionet.net/~timtroyr/funhouse/beer.html Here is a little more "spelled out" version in BETA: ORIGIN '~beta/basiclib/v1.4/betaenv' --- program: descriptor --- (* Author: Peter Andersen, Peter.Andersen@mjolner.dk *) (# bottles: @integer; putBottles: (# T: @text; high, low: @integer; cap: @boolean; few: (# i: @integer; enter i do (if i // 1 then 'one' -> T.append; // 2 then 'two' -> T.append; // 3 then 'three' -> T.append; // 4 then 'four' -> T.append; // 5 then 'five' -> T.append; // 6 then 'six' -> T.append; // 7 then 'seven' -> T.append; // 8 then 'eight' -> T.append; // 9 then 'nine' -> T.append; // 10 then 'ten' -> T.append; // 11 then 'eleven' -> T.append; // 12 then 'twelve' -> T.append; // 13 then 'thirteen' -> T.append; // 14 then 'fourteen' -> T.append; // 15 then 'fifteen' -> T.append; // 16 then 'sixteen' -> T.append; // 17 then 'seventeen' -> T.append; // 18 then 'eighteen' -> T.append; // 19 then 'nineteen' -> T.append; if); #); enter cap do bottles div 10 -> high; bottles mod 10 -> low; (if high // 0 then (if low=0 then 'no more' -> T; else bottles -> few; if); // 1 then bottles -> few; // 2 then 'twenty' -> T; low -> few; // 3 then 'thirty' -> T; low -> few; // 4 then 'fourty' -> T; low -> few; // 5 then 'fifty' -> T; low -> few; // 6 then 'sixty' -> T; low -> few; // 7 then 'seventy' -> T; low -> few; // 8 then 'eighty' -> T; low -> few; // 9 then 'ninety' -> T; low -> few; if); (if cap then (* Capitalize *) (1 -> T.inxGet -> ascii.upcase, 1) -> T.inxPut; if); T[] -> puttext; (if bottles=1 then ' bottle of beer' -> puttext; else ' bottles of beer' -> puttext; if); #); do 99->bottles; drinking: (if bottles>0 then true -> putBottles; ' on the wall, '->puttext; putBottles; '.' -> putline; 'Take one down, pass it around, '->puttext; bottles-1->bottles; putBottles; ' on the wall.\n'->putline; restart drinking if); #) Sincerely, Peter Andersen _____________________________________________________________________________ Mjolner Informatics Aps Phone: (+45) 86 20 20 00 ext. 2753 Science Park Aarhus Direct: (+45) 86 20 20 11 - 2753 Gustav Wieds Vej 10 Fax: (+45) 86 20 12 22 DK-8000 Aarhus C, Denmark Email: peter.andersen@mjolner.dk _____________________________________________________________________________ BETA is better -----------------------------------------------------------------------------