I sent you more hints privately.
(defn twice-composite? [n]
(->> (take-while #(< % n) prime-seq)
(every #(or (divides? (* 2 %) n)
(not (divides? % n))))
but this is not what you want. See the hints I sent you off the list.
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
Cheers,
Leif
com.example.sbox=> (time (count (semiprimes-to 100000000)))
"Elapsed time: 106157.33292 msecs"
41803068
It's single-threaded code running on a 2.5GHz machine, so I didn't
achieve this through massive parallelism or running it on a Cray or
anything. :)
If anyone wants more details or the code itself I can post it or email it.
> It is wonderful that people are so willing to help with a specific
> problem, and I encourage you to continue doing so, but I don't think
> anyone has answered the real question. Is there material out there
> that describes some of the mechanisms, tools, ideas, etc. that will
> allow the average clojure user to optimize their code.
Chapter 12 of Joy of Clojure is about performance (type hints, transience, chunked sequences, memoization, coercion).
Arguably much of the book is also about what you describe broadly, since it is trying to teach and encourage efficient, idiomatic Clojure usage generally, AIUI.
Gary