|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Re: Generating powerset with progressive orderingby blokhead (Monsignor) |
| on Feb 25, 2005 at 16:26 UTC ( #434546=note: print w/ replies, xml ) | Need Help?? |
|
I had an easier time thinking of this as manipulating the characteristic sequence of the subsets (i.e, a string of 0's and 1's, where the first bit is a 1 if the first factor is included in the subset, etc). If you look at the characteristic sequences given in your example, you can see that there are three rules being applied (you can print out $str to see what's going on under the covers). Anyway, this code does its manipulations on the characteristic sequence and converts it to the appropriate subset: I'd be interested to see this simplified a bit. I know you mentioned in the CB that tye had an idea for a solution, and I wonder if he's able to implement it with manipulations to the subsets themselves instead of their characteristic sequences. You also mentioned wanting to know when the "next phase" of iterations began (the horizontal lines in your example). You can figure this out by checking which substitution rule was actually applied. Update: Here is the code with the "next phase" markers:
blokhead
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||