1.3.0 permalink Arrow_down_16x16

extends?

clojure.core

  • (extends? protocol atype)
Returns true if atype extends protocol

1 Example top

  • user=> (defprotocol Area (get-area [this]))
    Area
    
    user=> (defrecord Rectangle [width height]
                      Area
                      (get-area [this]
                        (* width height)))
    user.Rectangle
    
    (extends? Area Rectangle)
    true
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core_deftype.clj:468 top

(defn extends? 
  "Returns true if atype extends protocol"
  {:added "1.2"}
  [protocol atype]
  (boolean (or (implements? protocol atype) 
               (get (:impls protocol) atype))))
Vars in clojure.core/extends?:
Used in 0 other vars

Comments top

No comments for extends?. Log in to add a comment.