Re: Arrays and indexes

2013-04-19 Thread John D. Hume
Both `for` and `doseq` support the same vector form preceding a body. `for` returns a lazy sequence and is often appropriate for a purely functional body. `doseq` is not lazy and returns nil, so it is only appropriate when you want to run the body for side effects. Take a look at http://clojure.gi

Re: Arrays and indexes

2013-04-19 Thread https://github.com/jmaandrade/orchestration
Hi, How about this? > (map-indexed (fn [i x] (vector x)) (for [x (range 10)] "HELLO WORLD")) (["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"]) Quinta-feira, 18 de Abril de 2013 11

Re: Arrays and indexes

2013-04-19 Thread edward
How does that work: you appear to be iterating over two, unconnected, vectors. And yes that's an example of the second option but doesn't explain if or why that's the best approach- which was the question ;) On Thursday, 18 April 2013 19:48:40 UTC+1, Alan Malloy wrote: > > (for [[y cols] (map-i

Re: Arrays and indexes

2013-04-18 Thread Alan Malloy
(for [[y cols] (map-indexed vector rows) [x cell] (map-indexed vector cols)] (display cell y x)) ? On Thursday, April 18, 2013 3:14:19 AM UTC-7, edw...@kenworthy.info wrote: > > So, I want a 2 dimensional array. > > I think the best way to implement this is a vector of vectors. > > Now I