You can't turn clojure.core/first into a protocol - it's already a bare function. When you define a protocol with a first method, you define a new function in your namespace called first, which delegates to protocol implementations. The compiler is complaining that you're shadowing clojure.core/first with your own version. That's not necessarily a bad thing, but nobody else will see the benefits of your new-and-improved first unless they make sure to call myns.core/first instead of clojure.core/first.
On Apr 4, 4:13 pm, Timothy Baldridge <tbaldri...@gmail.com> wrote: > I'm trying out some protocol code. Here's what I'm trying: > > (defprotocol AFirst > (first [s])) > > this blows up with : > > (defprotocol AFirst (first [f])) > Warning: protocol #'foo/AFirst is overwriting function first > WARNING: first already refers to: #'clojure.core/first in namespace: > foo, being replaced by: #'foo/first > AFirst > > What I want is to be able to have first do something different when > the type/record implements AFirst. But it looks like I may be going > about this the wrong way? > > Timothy > > -- > “One of the main causes of the fall of the Roman Empire was > that–lacking zero–they had no way to indicate successful termination > of their C programs.” > (Robert Firth) -- 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