Re: Why is this code so slow?

2013-02-03 Thread Alexandros Bantis
recur (bump-up n a k) k) (> n k) (recur n (bump-up k b n)) (= n k) n))) (defn smallest-multiple-of-1-to-n [n] (reduce lcm (range 1 (+ n 1 On Sunday, February 3, 2013 3:28:09 AM UTC+1, Alexandros Bantis wrote: Hello all. I'm working through the Project Euler problems in Java, Scala, &

Why is this code so slow?

2013-02-02 Thread Alexandros Bantis
Hello all. I'm working through the Project Euler problems in Java, Scala, & Clojure (trying to learn all three?!?). I notice that for one particular problem, I use--more or less--a similar algorithm for all three, but the clojure code runs about 20-30 times slower than the java/scala versions.