Hello Tassilo and All, Thank you for your comment. Yes, it is sorry that my 'fold-right' eat large stack. Using 'reverse' is good.
But I think 'reverse' is a special case of 'fold-right'. (fold-right #(concat %2 (list %)) '() '(:a :b :c :d)) ; -> (:d :c :b :a) If clojure's implementation of reverse don't consume stack, how does it do? https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L883 The source of 'reverse' says it uses 'reduce1' and commented "Not lazy". https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L865 The source of 'reduce1' says it uses 'chunk-seq?', '.reduce', 'chunk-first' and 'chunk-next'. What are these? And is there any lazy solution? Regards, Yoshinori Kohyama -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
