当我无意中将函数返回的列表(而不是向量)放入update-in时,这个问题让我感到困惑。
示例
`
some-app.core=> (update-in [:a :b :c] [1] name)
[:a "b" :c]
some-app.core=> (update-in '(:a :b :c) [1] name)
NullPointerException clojure.core/name (core.clj:1518)
`
如果传入另一个函数也会有类似的结果;例如
`
some-app.core=> (update-in ["a" "b" "c"] [1] str/capitalize)
["a" "B" "c"]
some-app.core=> (update-in '("a" "b" "c") [1] str/capitalize)
NullPointerException clojure.string/capitalize (string.clj:199)
`