here is my code,running on shadow-cljs.
(ns app.main
(:require [goog.structs.LinkedMap]))
(extend-type goog.structs.LinkedMap
cljs.core/IFn
(-invoke
([m k] (.get m k nil))
([m k not-found] (.get m k not-found))))
(def m (goog.structs.LinkedMap.))
(.set m 34 :foo)
(println (m 34))
The error message is as follows:#object[TypeError TypeError: app.main.m is not a function]
but I ran (type m)
, the result is as follow:#object[Function]
, This is indeed a function.