Re: randomizing a vector

2010-07-21 Thread Ryan Waters
I'm currently using clojure 1.1 and wasn't aware of shuffle in the contrib libraries. It felt like a wheel reinvention ... I should have looked harder! Thank you. On Wed, Jul 21, 2010 at 12:51 PM, Randy Hudson wrote: > Clojure 1.2 has a shuffle function. If you're using 1.1, you can just > cop

Re: randomizing a vector

2010-07-21 Thread Randy Hudson
Clojure 1.2 has a shuffle function. If you're using 1.1, you can just cop the 1.2 implementation. On Jul 21, 1:18 pm, Ryan Waters wrote: > http://gist.github.com/484747 > > - - - > > My sad little program has a number of issues and I would welcome > suggestions on any aspect of it.  I come from a

Re: randomizing a vector

2010-07-21 Thread Michael Gardner
On Jul 21, 2010, at 12:44 PM, Michał Marczyk wrote: > The biggest problem with the code is that it reconstructs the entire > `ordered-ips` vector minus the last entry picked at each iteration. It > would be simpler and *much* more performant to do > > (shuffle ordered-ips) > > Also note that Clo

Re: randomizing a vector

2010-07-21 Thread Michał Marczyk
The biggest problem with the code is that it reconstructs the entire `ordered-ips` vector minus the last entry picked at each iteration. It would be simpler and *much* more performant to do (shuffle ordered-ips) Also note that Clojure 1.2 provides an `rand-nth` function for doing (let [i (count

randomizing a vector

2010-07-21 Thread Ryan Waters
http://gist.github.com/484747 - - - My sad little program has a number of issues and I would welcome suggestions on any aspect of it. I come from an imperative programming background and clojure is my first experience with a functional or lisp language. I'd like to take a list of things (really