You're viewing version 1.2.0 of find-protocol-impl. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16



  • (find-protocol-impl protocol x)

0 Examples top

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:423 top

(defn find-protocol-impl [protocol x]
  (if (instance? (:on-interface protocol) x)
    (let [c (class x)
          impl #(get (:impls protocol) %)]
      (or (impl c)
          (and c (or (first (remove nil? (map impl (butlast (super-chain c)))))
                     (when-let [t (reduce pref (filter impl (disj (supers c) Object)))]
                       (impl t))
                     (impl Object)))))))
Vars in clojure.core/find-protocol-impl: and butlast defn first instance? let map nil? or remove when-let
Used in 2 other vars find-protocol-method satisfies?

Comments top

No comments for find-protocol-impl. Log in to add a comment.