Ordered partitions: Difference between revisions

Content added Content deleted
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (→‎{{header|Perl}}: Fix link and comment: Perl 6 --> Raku)
Line 1,679: Line 1,679:


Code 2: Recursive solution.
Code 2: Recursive solution.
{{trans|Perl 6}}
{{trans|Raku}}
<lang perl>use List::Util 1.33 qw(sum pairmap);
<lang perl>use List::Util 1.33 qw(sum pairmap);


Line 1,719: Line 1,719:
</pre>
</pre>


The set of ordered partitions is not returned in lexicographical order itself; but it's supposed to be a set so that's hopefully okay. (One could sort the output before printing, but (unlike in Perl 6) Perl's built-in sort routine cannot meaningfully compare arrays without being passed a custom comparator to do that, which is a little messy and thus omitted here.)
The set of ordered partitions is not returned in lexicographical order itself; but it's supposed to be a set so that's hopefully okay. (One could sort the output before printing, but (unlike in Raku) Perl's built-in sort routine cannot meaningfully compare arrays without being passed a custom comparator to do that, which is a little messy and thus omitted here.)


=={{header|Phix}}==
=={{header|Phix}}==