NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
The real way to write factorial in Perl 6: (Score:1)
It isn’t even worth pulling out into a function.
Re: (Score:1)
Perl Golf still lives, I see. I had started playing around with subsets and had intended to update it with stuff like that but I will just say wow...that is really neat.
Re: (Score:1)
It’s not golf! That’s just bog-standard Perl 6. Hyper- and reduce operators are normal part of the repertoire and in fact one of the reasons I am looking forward to v6. They get rid of huge swathes of monkey code… as you just saw. Lots of things that would require loops, which really constitute nothing but accidental complexity, can be expressed by a single operator.
Re: (Score:1)
Like all good things, I hope Perl 6 will change my perception of programming.
Re: (Score:1)
However, how will the simple
[*] 1..$nwork or fail when $n is large like 100 or 8.424000e+08 ? Does it magically transform to a generator and tail recursion under the covers, or does it do what it appears to say anBill
# I had a sig when sigs were cool
use Sig;
Re: (Score:1)
Perl 6 lets you write :-)
1..*(or alternatively1..Inf). That should answer your question.