I have this code to find all the permutations of a set of letters that form legal words.
<<Combinatorica`
Module[{str = "abc", chars, len, r, check},
chars = Characters[str];
len = StringLength[str];
r = Range[len];
check[n_Integer] :=
DictionaryLookup[{"BritishEnglish",
StringJoin[chars[[UnrankPermutation[n, r]]]]}, 1];
DistributeDefinitions[check, chars, r];
ParallelTable[check[i], {i, 1, len!}]]
I've verified that, if I replace ParallelTable with Table, I get this:
{{}, {}, {}, {"cab"}, {}, {}}
With ParallelTable, however, in addition to that result, I also get warnings like these:
Part::pspec: Part specification Combinatorica`UnrankPermutation[1,{1,2,3}] is neither a machine-sized integer nor a list of machine-sized integers.
Part::pspec: Part specification Combinatorica`UnrankPermutation[2,{1,2,3}] is neither a machine-sized integer nor a list of machine-sized integers.
StringJoin::string: String expected at position 1 in StringJoin[{a,b,c}[[Combinatorica`UnrankPermutation[1,{1,2,3}]]]].
StringJoin::string: String expected at position 1 in StringJoin[{a,b,c}[[Combinatorica`UnrankPermutation[2,{1,2,3}]]]].
These warnings seem to come from kernel 7 and higher. My guess is that the computation reaches those kernels and there isn't any data left, since there are only 6 permutations, and causes them to spit out those warnings.
Is my understanding correct? How do I prevent these warnings?
>>should be<<. – Michael E2 Mar 14 at 14:28