2011/1/21 Michael Gardner
> On Jan 21, 2011, at 10:35 AM, Laurent PETIT wrote:
>
> > As far as possible, the equivalent of a java anArray[anIndex] expression
> will be of not using an index in the first place in Clojure (*).
>
> Expanding on Laurent's answer: to transform one list into another, u
On Jan 21, 2011, at 10:35 AM, Laurent PETIT wrote:
> As far as possible, the equivalent of a java anArray[anIndex] expression will
> be of not using an index in the first place in Clojure (*).
Expanding on Laurent's answer: to transform one list into another, use 'map'.
In this case you can thi
2011/1/21 Armando Blancas
> I usually do something like this little sample. Calculations go in the
> let bindings and new elements are conjoined into the vector.
> (defn foo [n]
> (loop [v [] i 0]
>(if (= i n)
> v
> (let [x (* i i)]
>(recur (conj v x) (inc i))
> user=>
I usually do something like this little sample. Calculations go in the
let bindings and new elements are conjoined into the vector.
(defn foo [n]
(loop [v [] i 0]
(if (= i n)
v
(let [x (* i i)]
(recur (conj v x) (inc i))
user=> (foo 6)
[0 1 4 9 16 25]
On Jan 21, 8:07
2011/1/21 WoodHacker
> I'm converting the java code examples in Killer Game Programming in
> Java by Andrew Davison to Clojure and am having great fun doing it.
> But I've hit wall where I can't seem to get the code to work.
>
> The following code moves an animated gif strip to a java array:
>
>
If you're setting values in an array, use aset:
(dotimes [i number]
(aset strip i (.createCompatibleImage gc width height transparency))
...)
If you want to get a value, use aget:
(let [stripGC (.createGraphics (aget strip i))]
...)
Hope that helps,
Justin
On Jan 21, 11:07 am, WoodHacke
I'm converting the java code examples in Killer Game Programming in
Java by Andrew Davison to Clojure and am having great fun doing it.
But I've hit wall where I can't seem to get the code to work.
The following code moves an animated gif strip to a java array:
public BufferedImage[] loadStripI