I am attempting to :gen-class a fn which takes a 2D array of Doubles as input. I have already seen the post and solution here concerning a similar topic, but I am still unable to produce a working solution.
(ns gui.heatmap
(:gen-class
:name gui.Heatmap
:methods [[heat-map2 ["[[D"] org.jfree.chart.JFreeChart]]))
(defn foo [dbl-array]
...)
I use the "[[D" based on using type on my input. This compiles fine into a .class file.
Now, when I move to another .clj file, I have the following.
(ns ...
(import (gui.Heatmap)))
(defn bar [args]
...
(.foo
(into-array
(vector
(double-array <list of numbers>)
(double-array <list of numbers>)
(double-array <list of numbers>)))))
When I call bar from the repl, I get the following error:
java.lang.IllegalArgumentException: No matching field found: heat_map2 for class [[D
Any thoughts?
You are missing the object.
(.foo (into-array ...))vs(.foo (Heatmap.) (into-array...))Note, you should also
requireyourgui.Heatmapnamespace. Otherwise you can get into trouble if the...namespace is compiled beforegui.Heatmap. Then the import fails, because the class is not generated, yet. Adding therequirewill resolve this problem.Edit:
To clarify things.