Consider the function deeply-nested: (defn deeply-nested [n] (loop [n n result [:bottom]] (if (= n 0) result (recur (dec n) [result]))))
If you print it at the REPL for small values of n, no problem: (deeply-nested 25) -> [[[[[[[[[[[[[[[[[[[[[[[[[[:bottom]]]]]]]]]]]]]]]]]]]]]]]]]] But for large values of n: (deeply-nested 1000000) -> java.lang.StackOverflowError You can dodge this problem by setting *print-level* (set! *print-level* 25) -> 25 (deeply-nested 1000000) -> [[[[[[[[[[[[[[[[[[[[[[[[[#]]]]]]]]]]]]]]]]]]]]]]]]] But what if you really want to print a deeply nested structure? What is the simplest modification to core_print.clj that gets the job done? Is this a good use case for trampoline, or is there a better Clojurish way? Thanks, Stuart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---