ClojureDocs

Nav

Namespaces

extenders

clojure.core

Available since 1.2 (source)
  • (extenders protocol)
Returns a collection of the types explicitly extending protocol
1 Example
user=> (defprotocol P (id [this]))
P
user=> (extend-protocol P 
         String 
         (id [this] this)
         clojure.lang.Symbol 
         (id [this] (name this))
         clojure.lang.Keyword
         (id [this] (name this)))
nil
user=> (extenders P)
(java.lang.String clojure.lang.Symbol clojure.lang.Keyword)
See Also

A protocol is a named set of named methods and their signatures: (defprotocol AProtocolName ;...

Added by reborg

Returns true if atype extends protocol

Added by reborg
1 Note
    By , created 287 days ago

    ;;; it doesn't cover defrecord or deftype ;;; (Using example of the P protocol defined above) (defrecord PP [] P (id [this] (str this ":" this)))

    (deftype PPP [] P (id [this] (str this ":" this ":" this)))

    (extenders P) ;; => (java.lang.String clojure.lang.Symbol clojure.lang.Keyword)