On 13 January 2011 15:52, Maurits <maurits.r...@gmail.com> wrote:
> (defn all-protocols []
>  (filter #(protocol? @(val %)) (ns-publics *ns*)))
>
> (defn implemented-protocols [sym]
>  (filter #(satisfies? @(val %) sym) (all-protocols)))

Of course, this will restrict your search to protocols in a given namespace.

It might make sense to also add defrecords and deftypes to the
protocol's :impls map if they explicitly extend the protocol at
definition time, or to a new :direct-impls set, and make (extenders P)
return a union of these so it could always return all implementors of
protocol P. Or would this entail problems I don't see at the moment?

Daniel

-- 
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