A user on IRC named hiredman had the excellent idea (which should have occurred to me, but didn't) to macroexpand my code.
A macro expansion of (loop [[head & tail] (repeat 1)] (recur tail)) results in: (let* [G__10 (repeat 1) vec__11 G__10 head (clojure.core/nth vec__11 0 nil) tail (clojure.core/nthnext vec__11 1)] (loop* [G__10 G__10] (clojure.core/let [[head & tail] G__10] (recur tail)))) So, if I'm interpreting this correctly, it appears if you destructure in this way, there is going to be a reference to the seq held outside the loop itself. Does this mean, then, that this kind of heap explosion is inevitable using destructuring with large lazy seqs? It's hard for me to believe that is the case, and I'm definitely not a macro expert, so I'd be happy to be shown to be wrong. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---