how to determine what implements a protocol?

2010-02-10 Thread Raoul Duke
hi, is there a query to tell me if a datatype implements a particular protocol? i'm guessing there must be some forehead-slapping answer, but i haven't gleaned the clue yet :-{ thanks. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: how to determine what implements a protocol?

2010-02-10 Thread Stuart Sierra
No need to slap your forehead, but here it is: - clojure.core/extends? ([protocol atype]) Returns true if atype explicitly extends protocol -SS On Feb 10, 4:03 pm, Raoul Duke rao...@gmail.com wrote: hi, is there a query to tell me if a datatype implements a

Re: how to determine what implements a protocol?

2010-02-10 Thread Raoul Duke
On Wed, Feb 10, 2010 at 1:20 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: No need to slap your forehead, but here it is: - clojure.core/extends? ([protocol atype])  Returns true if atype explicitly extends protocol thanks! at least a d'oh will be required.

Re: how to determine what implements a protocol?

2010-02-10 Thread Raoul Duke
clojure.core/extends? doesn't seem to cover all the use cases? or i'm mistyping (er ha ha) something? (ns p) (defprotocol P1 (foo [this])) (ns d) (deftype T1 [f] :as this p/P1 (foo [] (println this))) (deftype T2 [f] :as this) (extend ::T2 p/P1 {:foo (fn [this] (println this))}) (println P1?T1

Re: how to determine what implements a protocol?

2010-02-10 Thread Meikel Brandmeyer
Hi, Am 10.02.2010 um 22:20 schrieb Stuart Sierra: No need to slap your forehead, but here it is: - clojure.core/extends? ([protocol atype]) Returns true if atype explicitly extends protocol This only checks whether extend was explicitly called on atype. What you