Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一系列 ClojureScript 对象,但其中只有一些实现了某种协议。如何检测协议是否在特定对象上扩展?
您可以使用satisfies?来检查对象是否扩展了协议。
satisfies?
(defprotocol p (go [_] nil)) (deftype t [] p (go [this] true)) (satisfies? p (t.)) ;=> true