我有返回 LazySeq 的 Clojure 函数。当我从 REPL 运行这个函数时,它工作得很好。但是,如果我尝试从 Java 代码中调用相同的函数,如下所示:
Object result = com.acme.forecast.core.runforecast("file1.csv", "file2.txt");
我得到以下异常:
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException:
clojure.lang.LazySeq cannot be cast to java.lang.Number
at com.acme.forecast.core.runforecast(Unknown Source)
at com.acme.forecast.client.gui.ClientGUI.actionPerformed(ClientGUI.java:180)
我的 gen-class 说我返回的是 LazySeq,而不是数字:
(:gen-class
:name com.acme.forecast.core
:methods [#^{:static true} [runforecast [String String] clojure.lang.LazySeq]])
这里出了什么问题?