为什么clojure会给出这个arity错误

Sul*_*end 1 clojure

我有下面的函数定义用于map-edit

(def map-edit
  (fn [m lst k f]
    (if (car lst)
      (assoc m
             (car lst)
             (map-edit (get m (car lst) {}) k f))
      (assoc m k (f (get m k))))))
Run Code Online (Sandbox Code Playgroud)

当我尝试在我的repl中调用此函数时

(map-edit {} (list "oeu") "oeuoeu" (fn [q] "oeu"))
Run Code Online (Sandbox Code Playgroud)

我得到了Arity的错误

ArityException Wrong number of args (3) passed to: core/map-edit  clojure.lang.AFn.throwArity (AFn.java:429)
Run Code Online (Sandbox Code Playgroud)

为什么它认为我只传递3个参数?

; CIDER 0.8.2 (Java 1.8.0_121, Clojure 1.8.0, nREPL 0.2.12)
Run Code Online (Sandbox Code Playgroud)

Sul*_*end 6

假设你有这些定义

(def car first)
(def cdr rest)
Run Code Online (Sandbox Code Playgroud)

对map-edit的递归调用仅使用该行可能应该有的3个参数

(map-edit (get m (car lst) {}) (cdr lst) k f))
Run Code Online (Sandbox Code Playgroud)

确保下次更仔细地查看错误的堆栈跟踪.