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"

-- 
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

Reply via email to