Hi Andreas, I recently discovered a wiki of Clojure Euler solutions, thought you might be interested:
http://clojure-euler.wikispaces.com/ On Feb 16, 1:15 am, Andreas Kostler <andreas.koestler.le...@gmail.com> wrote: > Thanks for everyone who commented on my solution for Euler 28 yesterday. > Euler 40 is a bit easier, even more so I'm disappointed with the performance > of my solution:(defn euler-40 [n-max] > > (reduce #(* (Integer/valueOf (str %1)) (Integer/valueOf (str %2))) > (let [r (range (inc n-max))] > (for [n (iterate #(* % 10) 1) :while (< n n-max)] (nth (apply > str r) n))))) > > It takes about 4s to find the solution. > > First of all, I guess the whole Integer/valueOf ceremony doesn't affect > performance but could probably be dealt with in a more idiomatic way. > Other than that, how could I optimise the presented solution. Hints to other > solutions (as long as they're pretty ;)) are also welcome :) > > Thanks again > Andreas > > -- > "Programs must be written for people to read, and only incidentally for > machines to execute." > - Abelson & Sussman, SICP > -- > ********************************************************** > Andreas Koestler, Software Engineer > Leica Geosystems Pty Ltd > 270 Gladstone Road, Dutton Park QLD 4102 > Main: +61 7 3891 9772 Direct: +61 7 3117 8808 > Fax: +61 7 3891 9336 > Email: andreas.koest...@leica-geosystems.com > > ************www.leica-geosystems.com************* > > when it has to be right, Leica Geosystems > > Please consider the environment before printing this email. -- 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