1

I have a series of ClojureScript objects, but only some of them implement a certain protocol. how can I detect if the protocol is extended on a particular object?

1 Answer 1

2

You can use satisfies? to check if the object extends the protocol.

(defprotocol p
  (go [_] nil))

(deftype t []
  p
  (go [this] true))

(satisfies? p (t.)) ;=> true
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.