Language Alef
| Date: | 07/24/05 |
| Author: | Christian Klein |
| URL: | http://blogs.23.nu/c0re/ |
| Comments: | 0 |
| Info: | http://www.cs.bell-labs.com/who/rsc/thread/alef.pdf |
| Score: |
adt Shelf
{
int count;
Shelf *s init(int);
void decrease (Shelf *s);
int left (Shelf *s);
void print (Shelf *s);
}
Shelf * Shelf.init (int cnt)
{
Shelf *s;
alloc s;
s->count = cnt;
return s;
}
void Shelf.decrease (Shelf *s)
{
s->count--;
return;
}
int Shelf.left (Shelf *s)
{
if s->count > 0
return 1;
return 0;
}
void Shelf.prints (Shelf *s)
{
if (!s->left(s))
print("no more bottles of beer on the wall");
print("%d one the wall",s->count,"Bottles" ? b->count>1 : "Bottle");
return;
}
void main (int argc, char **argv)
{
int i;
Shelf *s;
s = s.init(99);
while (s->left(s))
{
prints(s);
b.decreass(s);
}
return;
}
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