Re: Overwrite equals in defrecord

2013-10-25 Thread Marc Dzaebel
>> use deftype which is more low-level and I think doesn't define equals or put y in meta data that don't participate in equality...:) Hi Jim, this works! However, if you need the multiple features of records, you would need to have the generated code of defrecord in order to reimplement recor

Re: Overwrite equals in defrecord

2013-10-22 Thread Marc Dzaebel
http://cmayes.wikispaces.com/PracticalClojure13: ... > defrecord does not support Java class inheritance, so it cannot override > methods of Java classes, even abstract classes. However, it does permit you > to override methods of java.lang.Object such as hashCode, equals, and > toString. Simpl

Overwrite equals in defrecord

2013-10-22 Thread Marc Dzaebel
(defrecord R [x y]) automatically defines a reasonable *equals* method using x & y. However, is it possible to overwrite the method as it should use X only? My tries resulted in *"Duplicate method name&signature in class ...". Do I have to use extend-type?* -- -- You received this message bec

Re: Counterclockwise

2013-09-06 Thread Marc Dzaebel
great, to hear, that this important window to the Clojure world is so actively developed! -- -- 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

Counterclockwise

2013-09-05 Thread Marc Dzaebel
Hi, I love this Eclipse-plugin, however, there are issues that are not even categorized since April 2013. It might be deliberate but does anyone know the status of this project? Thanks, Marc -- -- You received this message beca

Re: Performance Patterns

2013-07-17 Thread Marc Dzaebel
Frantisek, your timings macro is really helpful and you already have many interesting examples in the code. So I combine yours, mine and Alex recommendations as: - Programmatic creation of tests/docs to adapt to current Clojure versions - Systematically organized/grouped/sorted samples - Comment

Re: Performance Patterns

2013-07-17 Thread Marc Dzaebel
- really helpful links - accepting performance as more relevant, would IMHO strengthen Clojure So your wishes would be: - Systematically organized samples - Comments on causation - Using libraries to increase quality Thanks for your help, Marc -- -- You received this message because you are su

Performance Patterns

2013-07-14 Thread Marc Dzaebel
I'm often in need of performance comparisons/recommendations about different ways to code the same usecases. E.g. (time(let [x 2 y [0 1 2 3 4]] (dotimes [_ 1000] (remove *#{x}*y ;~950 ms (time(let [x 2 y [0 1 2 3 4]] (dotimes [_ 1000] (remove *#(= % x)*y ;~150 ms (time(let

Re: apply: increase performance by 60% for fixed length

2012-10-08 Thread Marc Dzaebel
So *applyn *is only 3% faster for generated sequences with 10 elements (on my machine with 1.4 too). Reducing the number of elements has a better effect: (let[t(fn[](applyn 5 + (range 1 6)))] (time(dotimes [_ 100] (t ;438 msec (let[t(fn[](apply + (range 1 6)))] (time(dotimes [_ 100]

apply: increase performance by 60% for fixed length

2012-10-07 Thread Marc Dzaebel
*apply *is slow. However you can increase performance by 60% with the following macro, if you have a fixed length in S. (defmacro *applyn *[n f & s] (loop [curr `(list* ~@s), n n, vars[] vals[]] (if(pos? n) (let[v(gensym)] (recur v (dec n) (conj(conj vars v)

Re: Preferred business rules engines in or used by Clojure?

2012-10-07 Thread Marc Dzaebel
http://www.jboss.org/drools is a suite of tools. ~100 man years were necessary for this open source tool. I would not try to reimplement it in Clojure, but it's Java :-) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send ema

Re: interleave

2012-10-04 Thread Marc Dzaebel
At the end, the problem is apply (apply + '(1 2 3 4 5 6 7 8 9 10)) is ~60 times slower than (+ 1 2 3 4 5 6 7 8 9 10) -- 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 n

Re: interleave

2012-10-03 Thread Marc Dzaebel
Thanks for the link! I proposed the change there. Am Mittwoch, 3. Oktober 2012 20:06:42 UTC+2 schrieb Andy Fingerhut: > > I don't know the reason for the current implementation rather than your > suggested one, but at least on the comment about 0 or 1 arguments has a > ticket for it: > > http://

interleave

2012-10-03 Thread Marc Dzaebel
clojure.core*/interleave *could be implemented as: (defn *interleave *[& s] (apply mapcat list s)) rather than: (defn *interleave* ([c1 c2] (lazy-seq (let [s1 (seq c1) s2 (seq c2)] (when (and s1 s2) (cons (first s1) (cons (first s2)

Re: maplist for core?

2012-09-30 Thread Marc Dzaebel
Well, I might have to collect usecases. -- 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 unsubscr

Re: maplist for core?

2012-09-30 Thread Marc Dzaebel
*expand *looks really useful too. -- 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 fr

maplist for core?

2012-09-30 Thread Marc Dzaebel
I often have the need to lazily iterate over rests of lists rather than elements. I frequently saw discussions about this topic. In CL it's called * maplist*, in Haskell it's *tails* (Scala missing?). Of course there are several methods to do this, e.g. (take-while identity (iterate next S)), bu

Re: Create dynamic vars programmatically

2012-09-07 Thread Marc Dzaebel
Sorry for delay, I had difficulties with Google Groups ... posted several times. Thanks about the hint about *with-local-vars*, Marc -- 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 t

Re: How create dynamic var programmatically

2012-09-07 Thread Marc Dzaebel
works, thanks! -- 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

Re: How create dynamic vars programmatically?

2012-09-07 Thread Marc Dzaebel
>> .setDynamic on the var. Works fine! See also http://blog.zolotko.me/2012/06/making-variable-dynamic-in-clojure.html. Should be documented ... Great help, thanks, Marc -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send e

How create dynamic vars programmatically?

2012-09-07 Thread Marc Dzaebel
(intern *ns* 's) creates a non dynamic variable, but how do I achieve (def ^:dynamic s) programmatically? Thanks, Marc -- 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