Could be. I think the first recursive call messes up the left argument, since the stack trick basically makes them "static" variables. So that technique doesn't work for multiple recursive calls...owell. That's just one of the sinister things about this function. For the same reason, it won't "tail-end" optomize out the recursion.
sub A
{
return 0 if $_[1] == 0;
return 2*$_[1] if $_[0] == 0;
return 2 if $_[1] == 1;
my $mm= $_[0]-1;
--$_[1];
$_[1]= &A;
$_[0]= $mm;
return &A;
}
That gives the right answer for A(3,3), but blows up with reading from a bad memory location on A(4,3). | [reply] [d/l] |