The problem is that defrecord explicitly defines the interface you are trying to implement, so you are effectively attempting to declare the interface twice. And since clojure.lang.seqable isnt a protocol, you cant redefine it with extend. So, you will have to rewrite the defrecord macro or similar that implements what defrecord does, except it will actually look at your interfaces to see if you are attempting to implement the same one, and then use the users interface if so.
Heres an example of a custom deftype i wrote which basically reimplements defrecord + some more. It is an 'AtomHash', which means it acts like a hash map (i.e. like a record), but instead of accessing the record slots directly, it accesses an atom, which itself contains the map. I never figured out how to make (merge (atom-hash {:a 2}) {:a 4}) return an atom-hash, but oh well. Actually, i think the new clojure 1.3 has internal protocols for merge. Anyways, from this, you can build a macro which replaces user defined sequences with any defaults. Or you could just use it as a template. (deftype AtomHash [val] Object (toString [this] (str "<AtomHash " @val ">")) clojure.lang.IPersistentMap clojure.lang.ILookup (valAt [this key] (get @val key)) (valAt [this key notfound] (get @val key notfound)) clojure.lang.IPersistentCollection (count [this] (.count @val)) (empty [this] {}) (cons [this e] (.cons @val e)) (equiv [this gs] (or (identical? this gs) (when (identical? (class this) (class gs)) (= val (.val gs))))) clojure.lang.Associative (containsKey [this k] (or (and (get @val k) true) false)) (entryAt [this k] (get @val k)) clojure.lang.Seqable (seq [this] (seq @val)) clojure.lang.IPersistentMap (assoc [this k g] (assoc @val k g)) (assocEx [this k g] (assoc this k g)) (without [this k] (.without @val k)) clojure.lang.IDeref (deref [this] @val)) ;;REPLACE namespace with implementation namespace (defmethod print-dup AtomHash [o w] (.write w "#=(util/atom-hash ") (print-dup @o w) (.write w ")")) (defmethod clojure.core/print-method AtomHash [o w] (.write w (.toString o))) (defn atom-hash ([] (atom-hash {})) ([a] {:pre [(map? a)]} (AtomHash. (atom a)))) ;;examples (let [{:keys [a b]} (atom-hash {:a 2})] (list a b)) -- 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