[Haskell-cafe] Stack Space Overflow.

John T Davis endymion84 at mac.com
Sun Mar 18 17:20:31 EDT 2007


I'm writing a simulation of a game of Nim with genetic programming.  
I've run into a stack space overflow problem with one of my functions  
(part of a class instance), which I've included below.

crossover_mutate enp = enp { progPop  = ansPop,
                                  numProgs = (numProgs enp) +  
(crossNum enp)}

         crossResult  = crossNimPlayerPop (progPop enp) (seed enp)  
(theBoard enp) (numProgs enp) (crossNum enp)
         mutateResult = mutateNimPlayerPop crossResult (mutateRatio enp)
         popParts = crossResult ++ mutateResult
         newPop   = Set.toAscList (Set.fromList popParts)

         ansPop   = tournament (newPop, newPop) (theBoard enp)

Now, here's where it gets weird.  I've got test data that I've run  
all the constituent functions (crossNimPlayerPop, mutateNimPlayerPop,  
tournament) on, and they all work as they should.  Now, when I run  
the same data on crossover_mutate, I get the aforementioned stack  
space overflow.  I'm totally stumped on this...  I've even run the  
equivalent of ansPop on the command line, and despite how truly  
unreadable the code is in that format, it runs fine.

Any suggestions or thoughts would be greatly appreciated.  Have a  
nice day.  :-)

						Thank you,
							John T Davis

More information about the Haskell-Cafe mailing list