Jump to content

Maximum triangle path sum: Difference between revisions

m
→‎{{header|Perl 6}}: Added missing language header
(→‎{{header|Perl 6}}: eschew .rotate in favor of [1..*] slice)
m (→‎{{header|Perl 6}}: Added missing language header)
Line 57:
<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.
<lang perl6>my @rows = slurp("triangle.txt").lines.map: { [.words] }
10,339

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.