I have this piece of code.
(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))))))
I have sequence of maps ({:id, :name, :price} {} {}). I need to find the map with the :name as given by me (Matching movie). When I give
(get-movie "Interstellar" contents)
where contents is
({:id 10000 :name "Interstellar" :price 1}{:id 10001 :name "Ouija" :price 2}).
I am getting the following exception. :
clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap AFn.java:437 clojure.lang.AFn.throwArity AFn.java:35 clojure.lang.AFn.invoke C:\Users\Shalima\Documents\Textbooks\Functional Programming\Programs\Assignment5.clj:53 file.test/get-movie C:\Users\Shalima\Documents\Textbooks\Functional Programming\Programs\Assignment5.clj:77 file.test/eval6219
I have been sitting with this for sometime now and still couldnt figure out what went wrong. What am I doing wrong here ?