Trying to write idiomatic clojure to create vector of vectors

2010-07-23 Thread Rising_Phorce
I'm coming from an imperative background and trying to stay away from "for loops" to do the task at hand. Given a size, I want to create a vector of vectors to represent a game board similar to Rich's ants or Conway's Game of Life (no wrapping necessary for me). A couple of questions. I will nee

Re: Trying to write idiomatic clojure to create vector of vectors

2010-07-23 Thread Edmund Jackson
Hi, Some time back Lau Jensen blogged something like this. Its starts here http://www.bestinclass.dk/index.clj/2009/10/brians-functional-brain.html but there are at least two follow ups. It might spark inspiration if you've not yet read it. Edmund On 22 Jul 2010, at 13:37, Rising

Re: Trying to write idiomatic clojure to create vector of vectors

2010-07-23 Thread Konrad Hinsen
On 22 Jul 2010, at 14:37, Rising_Phorce wrote: I will need to traverse the vectors sequentially but at each step there will be lots of sequential back and forward tracking. Arrays would be the natural imperative choice, but the docs recommend this only for inter-op. So are vectors the best choi

Re: Trying to write idiomatic clojure to create vector of vectors

2010-07-23 Thread Meikel Brandmeyer
Hi, On Jul 23, 4:19 pm, Konrad Hinsen wrote: > Instead of (take size (repeat nil)), you can write (replicate size   > nil). You can then make a square board filled with nils with Or just (repeat size nil). I think replicate was replaced by the two- arg form of repeat. Sincerely Meikel -- You