And here's the result of Recur_unroll...my $x; $x = 0;{my $f = fact($x); print "factorial($x)=$f\n";} $x++;{my $f = fact($x); print "factorial($x)=$f\n";} $x++;{my $f = fact($x); print "factorial($x)=$f\n";} $x++;{my $f = fact($x); print "factorial($x)=$f\n";} $x++;{my $f = fact($x); print "factorial($x)=$f\n";} $x++;{my $f = fact($x); print "factorial($x)=$f\n";} $x++;{my $f = fact($x); print "factorial($x)=$f\n";} $x++;{my $f = fact($x); print "factorial($x)=$f\n";} $x++;sub fact { $_[0] <= 0 and return 1; return $_[0] * fact($_[0] - 1); }
my $x; $x = 0; while ($x < 8) { my $f = fact($x); print "factorial($x)=$f\n"; } continue { ++$x } sub fact { $_[0] <= 0 and return 1; return $_[0] * eval{local @_=$_[0] - 1; $_[0] <= 0 and return 1; return $_[0] * fact($_[0] - 1); }; }
In reply to Re: Re: Playing with (macro/source-filter) fire
by sleepingsquirrel
in thread Playing with (macro/source-filter) fire
by sleepingsquirrel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |