Clojure: gen-class and double arrays

I try: gen-class a fn, which takes a two-dimensional array of double digits as input. I have already seen the message and solution here regarding a similar topic, but I still cannot create 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 "[[D"based on the use of typemy input. This compiles to a .class file.

Now, when I go 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 barfrom repl, I get the following error:

java.lang.IllegalArgumentException: Search field not found: heat_map2 for class [[D

Any thoughts?

+3
source share
2

. (.foo (into-array ...)) vs (.foo (Heatmap.) (into-array...))

, require gui.Heatmap. , ... gui.Heatmap. , . require .

Edit:

.

  • require
  • ( dbyrne!)
  • fix: import clause ( )
(ns gui.heatmap
  (:gen-class
    :name gui.Heatmap
    :methods [[heat-map2 ["[[D"] org.jfree.chart.JFreeChart]]))

(defn -foo [dbl-array]
  ...)

(ns ...
  (import gui.Heatmap))

(defn bar [args]
  ...
  (.foo
    (Heatmap.)
    (into-array
      (vector
        (double-array )
        (double-array )
        (double-array )))))
+3

. , -foo foo. , :prefix :gen-class.

+2

Source: https://habr.com/ru/post/1756196/


All Articles