2 Jul
2004
2 Jul
'04
6:07 p.m.
-- gaSolutionSpace :: [a] -> [a] -- gaSolutionSpace [] = gaSolutionSpace createRandomPopulation -- recursive base case gaSolutionSpace x = x : gaSolutionSpace (evolvepopulation x)
This isn't quite right - you don't want the *last* element to be the initial population, but the first. I think you mean: gaSolutionSpaceFrom :: a -> [a] gaSolutionSpaceFrom x = x : gaSolutionSpaceFrom (evolvepopulation x) gaSolutionSpace = gaSolutionSpaceFrom createRandomPopulation Note that "a" above should be replaced with your population type. Also note the "iterate" function in the standard library does just this. --KW 8-) -- Keith Wansbrough <kw217@cl.cam.ac.uk> http://www.cl.cam.ac.uk/users/kw217/ University of Cambridge Computer Laboratory.