我有一个参数继续使用我的向量参数并对其进行解构,即使我试图以多种方式避免它。
错误:
clojure.lang.ArityException: Wrong number of args (5) passed to: core$build-par-sel$fn
尝试1:
(defn build-par-sel
[& {:keys [^clojure.lang.PersistentVector par-vals best-val]}]
; Do stuff...
)
(let [best 100.0
pars [1.0 2.0 3.0 4.0]]
(let [par-sel (build-par-sel
:par-vals pars
:best-val best)]))))
尝试2:
(defn build-par-sel
[& {:keys [par-vals best-val]}]
; Do stuff...
)
(let [best 100.0
pars [1.0 2.0 3.0 4.0]]
(let [par-sel (build-par-sel
:par-vals pars
:best-val best)]))))
尝试3:
(defn build-par-sel
[par-vals best-val]
; Do stuff...
)
(let [best 100.0
pars [1.0 2.0 3.0 4.0]]
(let [par-sel (build-par-sel pars best)]))))
答案 0 :(得分:1)
在build-par-sel
创建的某个匿名函数中,报告粘贴的异常发生在build-par-sel
的定义内。在没有看到该功能的主体的情况下,我们无法解决这个问题。