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.
Re: Idiomatic Perl 6 (Score:1)
Re: (Score:1)
Fixed, thanks.
Fugly! (Score:1)
Re: (Score:2)
In some sense, I think it's entirely appropriate that solving a problem from (arguably) a mathematical domain ends up with a solution that looks mathematical. Just because this particular problem ends up with a mathematical-looking answer in Perl 6 doesn't mean that all Perl 6 programs will look like mathematics. Answers to problems in other domains will tend to look like the
Synthetic code (Score:1)
The essential complexity of this example is the same. Only it contains more words than operators.
'do' required? (Score:2)
FWIW, I think parentheses will work here also.
my @pascal := ([1], -> @p { [0, @p Z+ @p, 0] } ... *);Pm
Re: (Score:1)
Aye. I considered both forms, and went with the
doform.When binding has list precedence, neither parentheses nor the
dowill be needed.Nifty! (Score:2)
I really like this. I liked it even more as I worked through all of the examples to better understand them. One thing I would change:
The output is much clearer that way (at least to me). I actually tried to get it a touch more "triangly":
But wound up with this:
Re: (Score:1)
my $n = 10; := do [1], -> @p { [0,@p Z+ @p,0] } ... *;my @pascal
my $m = @pascal[$n - 1].perl.chars;
say (my $r = $_.perl).fmt("%{($m + $r.chars) div 2}s") for @pascal[^$n];
Produces this:
[1]
[1, 1]
[1, 2, 1]