Hex words: Difference between revisions
m
→{{header|Raku}}: remove interim variable, some unnecessary punctuation
Thundergnat (talk | contribs) (→{{header|Raku}}: Add a Raku example) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: remove interim variable, some unnecessary punctuation) |
||
Line 15:
=={{header|Raku}}==
Sorted by digital root with a secondary alphabetical sort.
<lang perl6>
▲my %hex = @words.grep( { not / <-[abcdef]> / } ).map: { $_ => dr(:16($_).comb.sum) };
say "{+%hex} hex words longer than 4 characters found in unixdict.txt:";
printf "%6s ➡ %8d ➡ %d\n", .key, :16(.key), .value for %hex.sort: { .value, .key }
my %many = %hex.grep: { +.key.comb.Set > 3 }
say "\nOf which {+%many} contain at least four distinct characters:";
printf "%6s ➡ %8d ➡ %d\n", .key, :16(.key), .value for %many.sort: { -:16(.key) }
{{out}}
<pre>26 hex words longer than 4 characters found in unixdict.txt:
|