in reply to Re: Playing with (macro/source-filter) fire
in thread Playing with (macro/source-filter) fire

Hmmm. I don't see what went wrong, but here's the output of the filter I get with use Unroll_loop after uncommenting the last print STDERR $source;
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); }
And here's the result of Recur_unroll...
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); }; }

Replies are listed 'Best First'.
Re: Re: Re: Playing with (macro/source-filter) fire
by stvn (Monsignor) on Jan 23, 2004 at 21:15 UTC

    Still not working for me. I tried downloading your code again (in case it was me), and ran both the Loop and Recurse filters. I have Filter::Simple version 0.79 (i upgraded this too), which uses Text::Balanced which I have version 1.89. Again, Mac OS X 10.3.2 with the default installed Perl 5.8.0. Should I upgrade anything?

    What platform are you on? I mean, the code looks like it should work. I dont see why its not though.

    -stvn