Jump to content

Word frequency: Difference between revisions

m
(→‎{{header|Raku}}: use % operator, add type constraint and properly align output)
m (→‎{{header|Raku}}: fix indent)
Line 4,001:
for @matcher -> $reg {
say "\nTop $top using regex: ", $reg.raku;
my @words = $file.comb($reg).Bag.sort(-*.value)[^$top];
my $length = max @words».key».chars;
printf "%-{$length}s %d\n", .key, .value for @words;
}
1,934

edits

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