in clojure I can do the following: (extend-protocol P clojure.lang.ISeq (f [x] ...) )
and this appears to give me a protocol that works for all sequence types If I do a similar thing in clojurescript (extend-protocol P cljs.core.ISeq (f [x] ...) ) I will get a type error. TypeError: 'undefined' is not an object (evaluating 'cljs.core.ISeq.prototype.... I believe I understand why - ISeq is itself a protocol in cljs but it is an interface in java. It appears then that I must extend the protocol to all sequence types explicitly. Is this correct? Is there a good way to do this? A couple of problems that I see here are: 1. There are many specific types which may result in a lot of repeated code. 2. The set of types that are sequences is also open - it may grow in subsequent clojurescript releases - so maintenance of explicit extension would be a problem. I realise that one way around this is to skip the protocol and write a function that tests relevant cases (seq? ...). Have I misunderstood something? Thanks Dave -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
