Hi Konrad,
In the original post, I put in the code, it was removed by the post
editor.
The way I wanted it implement, I have the main in java (gui and
stuff). I create a 3D array in java, it's an int array (i.e. int arr[]
[][] ) and call with that array to clojure.
It can be done in java at least 3 orders of magnitude faster so I'm
sure there is something I'm doing wrong.
I'll appreciate any suggestion.
Thanks,
Amnon
I've squeezed my example into two functions:
(defn light [arr x y]
(+ (aget arr x y 0) (aget arr x y 1) (aget arr x y 2))
)
(defn grey [arr]
(dotimes [x (length arr)]
(dotimes [y (alength (aget arr 0))]
(let [lg (int (/ (light arr x y) 3))]
(aset arr x y 0 lg)
(aset arr x y 1 lg)
(aset arr x y 2 lg)
))))