Re: performance improvments for the following code

2010-01-30 Thread Alex Osborne
Andy Fingerhut writes: > I don't know about using map, but here is a function inspired by one > called 'most' in Paul Graham's On Lisp. You could use (most fit-fn > (take k (shuffle popu))) in place of your (first ...) subexpression > above, and it would avoid sorting elements that you would oth

Re: performance improvments for the following code

2010-01-27 Thread Andy Fingerhut
On Jan 27, 8:21 pm, Scott wrote: > wondering if I can please get some advice on how to improve the > performance of this piece of code > > (defn select-n-tournament >   [popu fit-fn n] >   (let [k 7] >     (take n (repeatedly #(first (sort-by fit-fn > (take k (shuffle > popu)) >   ) > ) I don