It wont solve your performance problem but I think that your python code
translates to:
(defn f[a b c]
(+ (* c c c c) (* b b b) (* a a)))
(count
(into #{}
(for [c primes :while (< (f (first primes) (first primes) c) limit)
b primes :while (< (f (first primes) b c) limit)
On 12 Mrz., 07:48, tristan wrote:
> my clojure version
> http://github.com/tristan/project-euler-code/blob/4a17bc271b4b2743ee1...
Not about speed, but about readability:
(loop [c primes n #{}]
(let [r (loop [b primes n n]
(let [r (loop [a primes n n]
...)))
You should think about us
You should profile your code.
A cousin of mine was solving a problem from programmingchallenges.com
in C++. I wrote a solution in Clojure.
At the beginning, my version was astronomically slower. After
profiling, I reduced it to about 2x slower.
After modifying it to use Java arrays, it actually b
Setting that one
(set! *warn-on-reflection* true)
Helped a lot in my simulation model to find out where clojure/java
were having trouble. It pointed out that one of my main functions was
causing trouble, and could do with a bit of typehinting.
(defn #^Short find-all-epi
"turns the rx and stri
Hi guys,
I'm loving Clojure, but i'm having a lot of trouble writing programs
in it that run as fast as my python equivalents.
One example is code i've written for projecteuler.net problem 87 (for
those who don't want to see any solutions don't click the links
below :))
my python version
http://