Thanks for all the feedback and answers.

I have added my implementation below.

Maurits
---------------------

; test protocol and record

(defprotocol Log
  (log [this] "Method to log"))

(defrecord Foo [f1 f2]
  Log
  (log [this] (println (:f1 this) (:f2 this))))

(def foo (Foo. 13 42))
(log foo)

; the relevant stuff

(defn protocol? [maybe-p]
  (boolean (:on-interface maybe-p)))

(defn all-protocols []
  (filter #(protocol? @(val %)) (ns-publics *ns*)))

(defn implemented-protocols [sym]
  (filter #(satisfies? @(val %) sym) (all-protocols)))

(println (implemented-protocols foo))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to