Some repetition for challenge one.
As hinted at in my previous entry, the difference between finding words that contain a particular sequence (in any order) and finding anagrams is somewhat minor.
$ perl6 ch-1.p6 /usr/share/dict/words top opt, pot, top
Build it up to tear it down in challenge two.
I feel like what I ended up doing for challenge two was somewhat in the Perl 5
idiom. Each line of the file is processed into a sorted sequence of letters,
which is used as a key in a Hash of
SetHashes where the key of the second
dimension is the
.lced word itself to avoid counting duplicates.
Once the Hash is built, the maximum number of elements is found, and each entry with that number of elements is printed out — I’ve used a formatter to show the sequences, the number of matched words, and the words themselves.