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.

In fact, the only appreciable difference between my week 4 challenge 2 solution and my week 5 challenge 1 solution in context is the replacement of a operator with a === operator.

$ 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.

See the full solution at https://github.com/fjwhittle/perlweeklychallenge-club/blob/master/challenge-005/fjwhittle/perl6/ch-2.p6