Вопрос

I have an argument that keeps taking my vector argument and destructuring it, even as I try to avoid it several ways.

Error:

clojure.lang.ArityException: Wrong number of args (5) passed to: core$build-par-sel$fn

Attempt 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)]))))

Attempt 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)]))))

Attempt 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)]))))
Это было полезно?

Решение

The exception you paste is reported to happen inside the definition of build-par-sel, in some anonymous function that build-par-sel creates. We can't do more to solve this problem without seeing the body of that function.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top