Hex words: Difference between revisions

m
→‎{{header|Raku}}: remove interim variable, some unnecessary punctuation
(→‎{{header|Raku}}: Add a Raku example)
m (→‎{{header|Raku}}: remove interim variable, some unnecessary punctuation)
Line 15:
=={{header|Raku}}==
Sorted by digital root with a secondary alphabetical sort.
<lang perl6>mysub @wordsdr ($_ is copy) { $_ = 'dr(./unixdictcomb.txt'.IO.slurp.words.grep:sum) {while .chars > 31; $_ };
 
submy dr ($_ is copy) { $_%hex = dr('.comb/unixdict.sum) whiletxt'.IO.slurp.words.grep({ .chars > 1; $_3 })\
my %hex = @words.grep( { not / <-[abcdef]> / } ).map: { $_ => dr( :16($_).comb.sum ) };
 
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) };</lang>
{{out}}
<pre>26 hex words longer than 4 characters found in unixdict.txt:
10,333

edits