Hi Webb, What exactly you mean by '*The point was you aren't using lazy-seq as intended here since you are always creating a singleton sequence*' ? In my sum function:
( defn test-fc "sum of all collection elements using recursion and laziness" [coll] (letfn [(sum-fc [sum coll] (if (empty? coll) (cons sum nil) (lazy-seq(sum-fc (+ sum (first coll)) (rest coll)))) ) ] (sum-fc 0 coll) ) ) I intend to compute sum of '*210432423543654675765876879*' elements of a collection, by calling (test-fc (range 210432423543654675765876879)), if I Do this *(def x **(test-fc (range 210432423543654675765876879)))*, and then *x,*this is not the same thing with *(test-fc (range 210432423543654675765876879))* ?, I understand the issue related to time to compute this sum, but the same time is taken when I call x, right ? Thanks for the hint with trampoline function, really interested . Sorin. -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.