我有这段代码.
(defn get-movie [name-movie contents]
(loop [n (count contents) contents contents]
(let [movie (first contents)]
(if (= (:name (first contents)) name-movie)
(movie)
(recur (dec n) (rest contents))))))
Run Code Online (Sandbox Code Playgroud)
我有一系列地图({:id,:name,:price} {} {}).我需要找到地图:我给出的名字(匹配电影).当我给
(get-movie "Interstellar" contents)
Run Code Online (Sandbox Code Playgroud)
内容是哪里
({:id 10000 :name "Interstellar" :price 1}{:id 10001 :name "Ouija" :price 2}).
Run Code Online (Sandbox Code Playgroud)
我收到以下异常.:
clojure.lang.ArityException:错误的args(0)传递给:PersistentArrayMap AFn.java:437 clojure.lang.AFn.throwArity AFn.java:35 clojure.lang.AFn.invoke C:\ Users\Shalima\Documents \教科书\功能编程\程序\ Assignment5.clj:53 file.test/get-movie C:\ Users\Shalima\Documents\Textbooks\Functional Programming\Programs\Assignment5.clj:77 file.test/eval6219
我一直坐在这里已经有一段时间了,仍然无法弄清楚出了什么问题.我在这做错了什么?