>>>>> "a" == abigail <abigail@foad.org> writes: a> On Mon, Sep 18, 2000 at 11:49:02AM -0400, Josh Goldberg wrote: >> my @cache = (1); >> sub tayers { >> my $x = shift; >> @cache = (1); >> return undef if $x < 0; >> unless (defined $cache[$x]) { >> my $p = $cache[$#cache]; >> $cache[$_] = $p *= $_ for ($#cache+1..$x); >> } >> return $cache[$x]; >> } a> Well, as I said before, this routine is silly. It has a cache, but it's a> written in such a way it cleans the cache each time. So, it's doing a a> lot of useless work. Obviously. The detrimental cache clearing was an artifact of various benchmarking permutations. The original version that I sent to the list did not have this bug. It's a shame that my flawed version is the one that has propagated thru most of the thread. Hope you have a very nice day, :-) Tim Ayers (tayers@bridge.com) ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe