Hi all. I'm trying to learn clojure with the excellent "Programming Clojure" and projecteuler.net. I am encountering the java heap space error, and can't find a workaround, nor a smarter way to write my code (which I am certain exist).
Trying to solve Problem 14 (some spoilers might be ahead, for those wanting to solve it in the future). The problem and my code are in https://pastee.org/hj3sh here is the problem: I am trying to produce a map of one O(million) key-value pairs using a recursive function. I can produce a map of the first 100000 numbers in ~1300 msecs, with 217211 keys. However, for 150000 and up, I get java.lang.OutOfMemoryError: Java heap space. so, I assume my code is ok on efficiency, but the recursion is too deep. am I right? can anyone suggest a way to overcome this problem? any additional tips and thoughts on the code would be of great help to me, as I am making my first steps in clojure. Thank you, Aviad -- 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 Note that posts from new members are moderated - please be patient with your first post. 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