Hi, On 4 Nov., 04:58, ka <sancha...@gmail.com> wrote:
> (defprotocol OnlyHalfCooless x y z) > > Instead of > (defn is-this-cool? [o] (satisfies? Coolness o)) > > I need to now write: > (defn is-this-cool? [o] (or (instance? Cool1 o) (instance? Cool2 o)) > or, (even worse) > (defn is-this-cool? [o] (and (satisfies? OnlyHalfCoolness o) > (instance? Comparable o) (instance? Serializable o)) May I ask a heretic question: Why don't you specify the contract in the docstring of the protocol? (defprotocol Coolness "Yadddayaddablablablubber. Cool things have to be Comparable and Serializable." (x ..) (y ...)) If someone doesn't adhere to this contract, it's his program which is broken, not yours. Sincerely Meikel -- 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