> (defn cseq [n] > (if (= 1 n) > [1] > (cons n (cseq (if (even? n) > (/ n 2) > (+ (* 3 n) 1 )))))) > > (apply max-key count (map cseq (range 1 1000000))) > > Gives a heap error. > cseq is at most 525 elements long. > The solution is much more than 525 (> 800000). Note that you're probably computing the same thing over and over again so "memoize" can come very handy here.
-- 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