Hex words: Difference between revisions

m
→‎{{header|Raku}}: remove some more superstitious punctuation, type the digital root sub
m (→‎{{header|Raku}}: remove some more superstitious punctuation, type the digital root sub)
Line 85:
=={{header|Raku}}==
Sorted by digital root with a secondary alphabetical sort.
<lang perl6>sub dr (Int $_ is copy) { $_ = dr(.comb.sum) while .chars > 1; $_ }
 
my %hex = './unixdict.txt'.IO.slurp.words.grep({ *.chars > 3 })\
.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:";
10,327

edits