mt2k has asked for the wisdom of the Perl Monks concerning the following question:
I'm taking a list of letters and finding matches in the dictionary that contain a permutation of these letters. I have gotten to the point where if I pass it the string "ciolnaot", it will find 'location'. This is being done with the above-mentioned Algorithm::Permute. This is working fine, but now I need to add a new twist to it. I want to specify the length of the words the script will find in the dictionary. Meaning that if I specify the string "ciolnaot" and a length of 4, I want to find 'coal', 'colt', 'loin', 'lion', 'toil', and whatever other 4-letter words exist in there, and only the words of that length.
So rather than taking the string, splitting it and finding permutations of it, it seems it becomes more complicated as I think I'll need to get 4-character permutations from the original string of letters, and then permutate each of those permutations... Am I making sense anymore? :)
One thing I hope I may be missing is another module like Algorithm::Permute that is more advanced, in allowing permutation string lengths or something similar. Please help!
------------------------------------- eval reverse@{[lreP =>q{ tsuJ\{qq},' rehtonA' ,q{\}rekcaH },' tnirp']}[1+1+ 1,1-1,1+1,1*1,(1+1)*(1+1)]; -------------------------------------
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: N Permutations of M Items
by Zaxo (Archbishop) on Dec 20, 2002 at 08:27 UTC | |
Re: N Permutations of M Items
by Enlil (Parson) on Dec 19, 2002 at 23:25 UTC | |
Re: N Permutations of M Items
by traveler (Parson) on Dec 19, 2002 at 23:24 UTC | |
Re: N Permutations of M Items
by waswas-fng (Curate) on Dec 20, 2002 at 00:05 UTC | |
Re: N Permutations of M Items
by I0 (Priest) on Dec 20, 2002 at 03:38 UTC | |
Re: N Permutations of M Items
by atcroft (Abbot) on Dec 20, 2002 at 01:25 UTC |