// file tree-tools.choc
// author : D Parigot
// date : 24.04.97
class main {
int fact (int n)
{
int h;
int s;
case this:
if (this.h == 0)
{
this.s = 1;
}
else [ show A as this ]
{
this.s = A.s * this.h;
A.h = this.h -1;
}
case fact:
} // end fact
int fact (int n)
{
if (n == 0) fact = 1;
else [ show fact' as this ]
{
fact= fact'.fact * n;
fact'.n = n -1;
}
} // end fact
} // end class main