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 BlooP

Date:04/20/05
Author:Laurent Vogel
URL:http://lvogel.free.fr/
Comments:0
Info:n/a
Score: (3.02 in 91 votes)
#  BlooP version of 99 bottles of beer
#  Laurent Vogel,  http://lvogel.free.fr
#  (BlooP implementation found at the retrocomputing museum)
#  (remove comment lines starting with #)
#
define procedure ''p''[n,c]:
block 0: begin
    cell(0) <= 's ';
    if n = 1, then: cell(0) <= ' ';
    cell(1) <= n;
    if n = 0, then: cell(1) <= 'No more';
    print[cell(1), ' bottle', cell(0), 'of beer', c];
    output <= n;
block 0: end.

define procedure ''pred''[n]:
block 0: begin
    loop at most n times:
    block 1: begin
        if output + 1 = n, then:
        abort loop 1;
        output <= output + 1;
    block 1: end;
block 0: end.

define procedure ''beer''[n]:
block 0: begin
    output <= n;
    loop n times: 
    block 1: begin
        output <= p[output, ' on the wall,'];
        output <= p[output, '.'];
        print['Take one down, pass it around,'];
        output <= pred[output];
        output <= p[output, ' on the wall.'];
        print[' '];
    block 1: end;
    output <= ' '
block 0: end.

beer[99].

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: