Re: overriding seq in defrecord

2011-02-06 Thread Seth
I also found it useful to define my own clojure.core. This is because i wanted swap! and reset! to work on my AtomHash. So i did something like this, using clj-nstools. http://code.google.com/p/clj-nstools/ ns+ is sort of slow for large projects, but im sure that can be improved. (ns clj.core (:

Re: overriding seq in defrecord

2011-02-06 Thread Seth
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

Re: overriding seq in defrecord

2011-02-05 Thread Brian Goslinga
On Feb 5, 5:51 pm, Kees-Jochem Wehrmeijer wrote: > Well, my idea was for the type to hold a datastore query (Google App > Engine). At the moment I'm using a map for this. To get the results > from the query I have a function run-query that takes the map and > returns a seq based on an Iterable. I

Re: overriding seq in defrecord

2011-02-05 Thread Kees-Jochem Wehrmeijer
> Why do you want to override seq? The only reason that I can think of > is that you are implementing some sort of custom data type. If that is > the case, you should be using deftype instead; defrecord is a protocol- > aware drop in replacement for normal maps. Well, my idea was for the type to h

Re: overriding seq in defrecord

2011-02-05 Thread Brian Goslinga
Why do you want to override seq? The only reason that I can think of is that you are implementing some sort of custom data type. If that is the case, you should be using deftype instead; defrecord is a protocol- aware drop in replacement for normal maps. On Feb 5, 2:58 pm, Kees-Jochem Wehrmeijer

overriding seq in defrecord

2011-02-05 Thread Kees-Jochem Wehrmeijer
Hi all, I'm playing around with defprotocol and defrecord and I ran into a problem when trying to provide my own seq method. I try to create a record like so: (defrecord Foo [bar] clojure.lang.Seqable (seq [this] (seq this))) but I get an error: error: java.lang.ClassFormatError: Duplicate me