Letter frequency: Difference between revisions

Content added Content deleted
(→‎{{header|Perl 6}}: Update, add example usage)
m (→‎{{header|Perl 6}}: style twiddles)
Line 2,067: Line 2,067:
=={{header|Perl 6}}==
=={{header|Perl 6}}==
In perl6, whenever you want to count things in a collection, the rule of thumb is to use the Bag structure.
In perl6, whenever you want to count things in a collection, the rule of thumb is to use the Bag structure.
<lang perl6>.&ws.say for (bag slurp».comb).sort: -*.value;
<lang perl6>.&ws.say for slurp.comb.Bag.sort: -*.value;


sub ws ($pair) {
sub ws ($pair) {