![]() |
|
Just another Perl shrine | |
PerlMonks |
Re: Re: Re: Big Pictureby duelafn (Parson) |
on Oct 02, 2002 at 13:18 UTC ( #202253=note: print w/replies, xml ) | Need Help?? |
Actually, I (fortunately) do not need two for loops. The main loop of my code is this:
M1, M2, and M3 are the three moves (literally, the permutations represent lines in space) which return a new list of permutations. &ClassReunion just does some magic with the label $i. M1 is easy, it is just the cyclic permutations of the list Ex: M1(12345) -> 51234, 45123, 34512, 23451. sub M1 { map join(',', @_[$_..$#_], @_[0..$_-1]), 1..$#_ } M2 is the inverse permutation. The permutation 4132 is equivalent to tr/1234/4132/. The inverse would then be tr/4132/1234/.
M3 is, unfortunately much harder to explain, and has much longer code. I've posted a working version of the code on my sratchpad. If you /msg me I will post a better explanation of M3 there as well. Good Day, If we didn't reinvent the wheel, we wouldn't have rollerblades.
In Section
Seekers of Perl Wisdom
|
|