【发布时间】:2018-09-18 07:14:50
【问题描述】:
这是我从本网站另一篇帖子的答案中复制的代码:
(def data [[1 1 1 3] [2 2 2 3] [3 2 1 1] [4 3 3 4]])
(def replacements {1 "joe" 2 "fred" 3 "martha"})
(defn test
[]
(mapv (fn [row] (update row 1 replacements)) data)
)
当我在 REPL 中调用 (test) 时,它显示以下错误:
CompilerException java.lang.RuntimeException: Unable to resolve symbol: update in this context
为什么 Clojure 不知道更新函数?
【问题讨论】:
-
检查您使用的 Clojure 版本。在 1.7 中添加了更新
-
如果你在update-in(例如
(update-in row [1] replacements))
标签: clojure