Maximum triangle path sum: Difference between revisions
Content added Content deleted
(→{{header|Perl 6}}: eschew .rotate in favor of [1..*] slice) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Added missing language header) |
||
Line 57: | Line 57: | ||
<pre>1320</pre> |
<pre>1320</pre> |
||
=={{header|Perl 6}}== |
|||
The <tt>Z+</tt> and <tt>Zmax</tt> are examples of the zipwith metaoperator. We ought to be able to use <tt>[Z+]=</tt> as an assignment operator here, but rakudo has a bug. Note also we can use the <tt>Zmax</tt> metaoperator form because <tt>max</tt> is define as an infix in Perl 6. |
The <tt>Z+</tt> and <tt>Zmax</tt> are examples of the zipwith metaoperator. We ought to be able to use <tt>[Z+]=</tt> as an assignment operator here, but rakudo has a bug. Note also we can use the <tt>Zmax</tt> metaoperator form because <tt>max</tt> is define as an infix in Perl 6. |
||
<lang perl6>my @rows = slurp("triangle.txt").lines.map: { [.words] } |
<lang perl6>my @rows = slurp("triangle.txt").lines.map: { [.words] } |