Thanks, Christophe. It works now, and it's fast. Unfortunately, now I've run in to Nathan's problem. After a few thousand generations, resulting in the creation of about half a million functions it was using over a gig of memory and died with an OutOfMemoryError. While let-eval is cool, using it here makes the algorithm much slower (calls to eval are the slowest part, and that approach has n calls to eval instead of 1 when testing with multiple data).
I can think of a couple ways to restructure this so that it doesn't create a function, the most obvious being to eval doseq form containing the code, but it won't be as elegant as the current solution. This could be a real problem for Clojure. I can think of other techniques that could easily result in the creation a large number of anonymous functions that ought to get gc'd after a few ms but permanently increase memory usage by a significant amount. I don't know the JVM very well at all. Are there any ways around this? Are techniques that generate a lot of short-lived functions just not practical in Clojure? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---