I'm using the maven plugin so I think I'm using the lastest 1.2, and I've tried every 1.3 version, but I just got a hold of my laptop, and I am having no problems on there.
I was having several other problems too(I started another discussion complaining about a whittled down version of this program that doesn't work either), maybe when I get home I'll try a reboot. On Dec 30, 8:33 am, Bob Shock <shock...@gmail.com> wrote: > I don't get any errors when I run your code. This is the output: > > 1 1 > 1 1 > 1 1 > 1 1 > 1 1 > 1 1 1 1 1 > 1 1 1 1 1 > > Are you sure you are using the latest Clojure 1.2 version and not an > early beta, etc.? > > Process finished with exit code 0 > > On Dec 29, 11:25 pm, Jarl Haggerty <fictivela...@gmail.com> wrote: > > > What is wrong with my code(bottom of post)? I keep getting this > > error. Line 24 is "(get-cell [x r c] 1))" in the Matrix deftype and > > 36 is "(print (get-cell one r c) " "))" in the first nested "doseq"s. > > I'm on Windows 7 with Clojure 1.2. > > > Exception in thread "main" java.lang.IllegalArgumentException: > > Argument is not an array (core.clj:0) > > at clojure.lang.Compiler.eval(Compiler.java:5440) > > at clojure.lang.Compiler.load(Compiler.java:5857) > > at clojure.lang.Compiler.loadFile(Compiler.java:5820) > > at clojure.main$load_script.invoke(main.clj:221) > > at clojure.main$script_opt.invoke(main.clj:273) > > at clojure.main$main.doInvoke(main.clj:354) > > at clojure.lang.RestFn.invoke(RestFn.java:409) > > at clojure.lang.Var.invoke(Var.java:365) > > at clojure.lang.AFn.applyToHelper(AFn.java:163) > > at clojure.lang.Var.applyTo(Var.java:482) > > at clojure.main.main(main.java:37) > > Caused by: java.lang.IllegalArgumentException: Argument is not an > > array > > at java.lang.reflect.Array.get(Native Method) > > at clojure.core$aget.invoke(core.clj:2994) > > at clojure.lang.AFn.applyToHelper(AFn.java:165) > > at clojure.lang.RestFn.applyTo(RestFn.java:133) > > at clojure.core$apply.invoke(core.clj:542) > > at clojure.core$aget.doInvoke(core.clj:2996) > > at clojure.lang.RestFn.invoke(RestFn.java:443) > > at com.curious.scratch.core.Matrix2D.get_cell(core.clj:24) > > at com.curious.scratch.core$eval122.invoke(core.clj:36) > > at clojure.lang.Compiler.eval(Compiler.java:5424) > > ... 10 more > > > (def float-array-class (class (float-array 1))) > > (defprotocol Matrix > > (matrix-data [x]) > > (matrix-height [x]) > > (matrix-width [x]) > > (matrix-add [x] [x y] [x y & args]) > > (get-cell [x r] [x r c])) > > > (deftype Matrix2D [data height width] > > Matrix > > (matrix-data [x] data) > > (matrix-height [x] height) > > (matrix-width [x] width) > > (matrix-add [x] x) > > (matrix-add [x y] > > (let [x-data (matrix-data x) > > y-data (matrix-data y) > > z-data (amap ^floats x-data index z-data (+ (aget > > ^floats x-data index) (aget ^floats y-data index)))] > > (Matrix2D. z-data (matrix-width x) (matrix-height > > x)))) > > (matrix-add [x y & args] (reduce matrix-add (matrix-add x y) args)) > > (get-cell [x r] (get-cell x r 0)) > > (get-cell [x r c] 1)) > > > (defn matrix [data height width] > > (if (instance? float-array-class data) > > (Matrix2D. data height width) > > (Matrix2D. (float-array data) height width))) > > > (def one (matrix (range 10) 5 2)) > > (def two (matrix-add one one)) > > > (doseq [r (range (matrix-height one))] > > (doseq [c (range (matrix-width one))] > > (print (get-cell one r c) " ")) > > (println)) > > > (doseq [r (range (matrix-height two))] > > (doseq [c (range (matrix-width two))] > > (print (get-cell two r c) " ")) > > (println)) > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en