You're viewing version 1.2.0 of extends?. The latest stable version of Clojure Core is 1.3.0.
1.2.0 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:444 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?: boolean defn get or
Used in 0 other vars

Comments top

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