Variable-length arguments in protocols seem to be supported, but there's just a weird, stateful behavior. Look what happens when you call foo first with one argument twice (it fails both times), then two arguments (it succeeds), then one argument again (it succeeds now too!). Is this a Clojure bug?
Clojure 1.1.0-alpha-SNAPSHOT user=> (defprotocol P (foo [x & args])) P user=> (deftype T [x]) #'user/T user=> (extend ::T P {:foo (fn [x & args] args)}) nil user=> (foo (T 42)) java.lang.IllegalArgumentException: Wrong number of args passed to: user$eval--12$fn--14$G--1 (NO_SOURCE_FILE:0) user=> (foo (T 42)) java.lang.IllegalArgumentException: Wrong number of args passed to: user$eval--12$fn--14$G--1 (NO_SOURCE_FILE:0) user=> (foo (T 42) 1 2) (1 2) user=> (foo (T 42)) nil -- 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