Hi, as others said: to check that a protocol function exists you can use resolve as with every other function.
If you wanted to know, whether a type participates in a protocol directly, you would check whether it implements the protocol's interface . user=> (defprotocol Foo (foo [this])) Foo user=> (defrecord Bar [] Foo (foo [this] :foobar)) user.Bar user=> (instance? user.Foo (Bar.)) true If you wanted to know whether the protocol is extended to this type in general you would use satisfies?. Sincerely Meikel Am Mittwoch, 29. Februar 2012 23:12:48 UTC+1 schrieb Frank: > > Hi, > > The behaviour of resolve for named functions seems pretty clear to me: > > (resolve 'xyz) > > returns nil (when xyz has not been defined). > > and > > (defn xyz [x] 1) > > (resolve 'xyz) > > returns #'user/xyz (when xyz is defined) > > However if I try to define types: > > (defprotocol Named > (fullName [Named])) > > > (deftype Person [firstName lastName favoriteColor] > Named > (fullName [_] (str firstName " " lastName))) > > Why do the following return nil? > > (resolve '.fullName) > > or > > (resolve '.firstName) > > > What should I be using to check that the symbol .firstName and > .fullName are defined in the current scope? > > (I am trying to write compile-time code the filters/selects undefined > symbols from a chunk of quoted code. > I'd like this to work for both function symbols and method symbols.) > > I'm using clojure 1.3 > > Thanks, > > Frank > > -- 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