in reply to Re: sum of counts
in thread sum of counts

That didn't really suck. Now this sucks!
sub Sum {my @s = @_ ? ((0) x shift, Sum(@_)) : @_} $n = Sum(10..100); print $n;

Replies are listed 'Best First'.
(tye)Re3: sum of counts
by tye (Sage) on Jan 17, 2001 at 02:57 UTC

    Well, I felt it vitally important to see exactly how much of an improvement this really is so I benchmarked it:

    Benchmark: running tilly_l, tilly_s, tye_l, tye_s, each for at least 3 + CPU seconds... Out of memory!
    Oops. Um, let me try that again:
    Benchmark: running tilly_l, tilly_s, tye_l, tye_s, each for at least 3 + CPU seconds... tilly_l: 5.14 CPU @ 0.39/s (n=2) (warning: too few iterations for a reliable count) tilly_s: 3.25 CPU @ 18.44/s (n=60) tye_l: 3.16 CPU @ 443.43/s (n=1403) tye_s: 3.25 CPU @ 1691.22/s (n=5488)
    Ah, yes, an admirable improvement. But my code still looks nicer, which was the point.

    So I win this round... ; )

            - tye (but my friends call me "Tye")