Clojure newbie struggling with protocols <p>I am attempting to build out the <a href="https://github.com/dustingetz/react-cursor" rel="nofollow">concept of a Cursor</a> in clojurescript, backed by an atom. A cursor is a recursive zipper like mechanism for editing an immutable nested associated datastructure.</p> <p>I am very newbie at Clojure, can you help me spot my errors?</p> <pre><code>(defprotocol Cursor (refine [this path]) (set [this value]) (value [this])) (defn- build-cursor* [state-atom paths] (reify Cursor (set [this value] (swap! state-atom (assoc-in @state-atom paths value))) (refine [this path] (build-cursor* state-atom (conj paths path))) (value [this] (get-in @state-atom paths)))) (defn build-cursor [state-atom] (build-cursor* state-atom [])) (comment (def s (atom {:a 42})) (def c (build-cursor s)) (assert (= (value c) {:a 42})) (set c {:a 43}) ;; WARNING: Wrong number of args (2) passed to quiescent-json-editor.core/set at line 1 &lt;cljs repl&gt; (assert (= (value c) {:a 43})) (def ca (refine c :a)) ;; WARNING: Wrong number of args (2) passed to quiescent-json-editor.core/refine at line 1 &lt;cljs repl&gt; (assert (= (value ca) 43)) (set ca 44) (assert (= (value ca) 43)) ) </code></pre>