Hi all,

My environment is, Kubuntu 11.10, Clojure v1.3 and sun-java6-jdk. I
issued the following forms in REPL:

user=> (def n 100000000)
#'user/n
user=> (time (loop [cnt 100000000 sum 0] (if (zero? cnt) sum (recur
(dec cnt) (+ sum cnt)))))
"Elapsed time: 605.564858 msecs"
5000000050000000
user=> (time (loop [cnt n sum 0] (if (zero? cnt) sum (recur (dec cnt)
(+ sum cnt)))))
"Elapsed time: 3707.245668 msecs"
5000000050000000

Why did the second loop so slow?!

Thanks!

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

Reply via email to