On Tue, Dec 21, 2010 at 12:44 PM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote:
> It's a funy and original trick but on this example at least, > it seems slower (and it can use a lot of memory, because it retains a > stack in the heap) than trampoline: > > (time (get-value (even 15000000))) > "Elapsed time: 1899.881769 msecs" > > And a version with trampoline > > (defn odd [^long x] > (if (zero? x) > false > #(even (dec x)))) > > (defn even [^long x] > (if (zero? x) > true > #(odd (dec x)))) > > (time (trampoline (even 15000000))) > "Elapsed time: 366.496137 msecs" On my machine I don't see this difference at all. And the lazy-seq version is slightly faster. I'm on Clojure 1.3.0-alpha3. David -- 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