> I don't like special casing stuff and the 3 selections outside the> "main" > flow sticks out in my solution. I guess that is right. Any logic that is outside the main flow breaks the beauty and create kludge.
Attempted to solve the same problem using Erlang, and surprisingly what was looking like kludge in python perfectly blends with recursion and pattern-matching. Attached is the file. If you have erlang installed, $ escript golf.erl # To execute A note on the source, 1. Only lines 6-14 are part of the golf permutation logic. 2. Function main() provides execution entry point. 3. Function ootygames() provides the sample data. 4. Function shuffle() is copy paste of Knuth / Fischer - Yates shuffle algorithm And interestingly it takes just N+3 pass on the sample list (plus O(NlogN) for shuffle() ) .... Cheers, On Mon, Dec 26, 2011 at 4:32 PM, Noufal Ibrahim <nou...@gmail.com> wrote: > Kenneth Gonsalves <law...@gmail.com> writes: > > > [...] > >> just curious - why do you and Noufal think this is a crude method? > > > -- > ~noufal > http://nibrahim.net.in > > Parting is such sweet sorrow. -William Shakespeare > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers -- Pratap.
_______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers