Hex words: Difference between revisions
m
→{{header|Raku}}: remove some more superstitious punctuation, type the digital root sub
m (→{{header|Factor}}: simplify) |
Thundergnat (talk | contribs) 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(
.grep({ not / <-[abcdef]> / }).map: { $_ => dr
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:
say "\nOf which {+%many} contain at least four distinct characters:";
|