How to check if a particular protocol is recording?

I have a protocol:

(defprotocol IInterval
  (-duration  [in]))

and the record that implements it:

(defrecord Interval [start end]
  IInterval
  (-duration  [_] (- end
                     start)))

if i create (def i1 (Interval 0 1000))

how can i use a method implements?where:

(implements? IInterval i1) => true
+4
source share
1 answer

You can use satisfies?:

(satisfies? IInterval i1)
+8
source

All Articles