Skip to content

Instantly share code, notes, and snippets.

@si14

si14/test.clj Secret

Created June 17, 2012 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save si14/209b5b7fead972e01296 to your computer and use it in GitHub Desktop.
Save si14/209b5b7fead972e01296 to your computer and use it in GitHub Desktop.
Uncaught Error: No protocol method ILookup.-lookup defined for type object: [object Object]
(defrecord Test [foo bar])
(defn test2 [map]
(reify
IAssociative
(-assoc [coll k v]
(.log js/console (str "setting " (pr-str k) " to " (pr-str v)))
(test2 (-assoc map k v)))
(-contains-key? [coll k] (-contains-key? map k))))
(defn ^:export init []
(let [t (Test. 1 2)
a (test2 t)]
(assoc-in (assoc a :foo 3) [:bar] 4)
(.log js/console (pr-str (:foo a)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment