How to handle refactoring with TDD and mocking/stubbing

2014-12-31 Thread Jonathon McKitrick
I use TDD and mocking/stubbing (conjure) to test each layer of my code. The problem is when I change the function signature and the tests do not break, because the mocks/stubs do not know when their argument lists no longer agree with the underlying function they are mocking. Is there a way t

Re: How to handle refactoring with TDD and mocking/stubbing

2014-12-31 Thread Ashton Kemerling
I've always done the full database setup and tear down thing, but that's made sufficiently performant with datomics in memory store. Consider using transactions to isolate tests, or use Midje, which is more designed for this kind of usage. --Ashton Sent from my iPhone > On Dec 31, 2014, at 9

Re: How to handle refactoring with TDD and mocking/stubbing

2014-12-31 Thread Timothy Baldridge
This is one of the main reasons why I try to stay clear of heavy use of invasive mocks. I can't tell you the amount of times I've looked at code and realized that because of mocks nothing was really being tested at all. Instead, think of mocks as the terminator in a test chain. That is to say, they

Re: How to handle refactoring with TDD and mocking/stubbing

2014-12-31 Thread Sean Corfield
On Dec 31, 2014, at 8:24 AM, Timothy Baldridge wrote: > This is one of the main reasons why I try to stay clear of heavy use of > invasive mocks. I can't tell you the amount of times I've looked at code and > realized that because of mocks nothing was really being tested at all. > Instead, thin

How to handle fn args in a macro ?

2014-12-31 Thread rogergl
I just started to play with macros in Clojure. The following is a simple example that expands to: (on-message "topic-test" (clojure.core/fn [topic13730] (println topic13730 "test"))) To make this work I had to replace the symbol 'topic in the body with the gensym symbol. Is this the right wa

Re: How to handle fn args in a macro ?

2014-12-31 Thread Tobias Kortkamp
On 12/31/2014 18:56, rogergl wrote: > To make this work I had to replace the symbol 'topic in the body with > the gensym symbol. Is this the right way to do this ? Your macro is too complicated. You don't need to gensym a symbol in this case. Instead just quote a symbol before unquoting it (note

ANN: Om 0.8.0-rc1

2014-12-31 Thread David Nolen
I just cut Om 0.8.0-rc1. The only change from prior betas/alphas is more bug fixes. https://github.com/swannodette/om Feedback welcome! David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.c

lazy-seq performance

2014-12-31 Thread Sakis K
Hi, Clojure newbie here :) I'm reading "Programming Clojure" by Halloway and Bedra. In the book there is a lazy-seq example of the Fibonacci sequence: (defn lazy-seq-fibo ([] (concat [0 1] (lazy-seq-fibo 0N 1N))) ([a b] (let [n (+ a b)] (lazy-seq

Re: lazy-seq performance

2014-12-31 Thread Daniel
The first thing that jumps out at me are the boxed numbers: 0N and 1N. I'm guessing the Clojure implementation can produce a much larger result than the python implementation can - so, apples to oranges. Probably unbox the numbers and you get much more comparable speed. Also, you should defin

Re: lazy-seq performance

2014-12-31 Thread Ashton Kemerling
I was going to say that testing JVM programs is notoriously tricky due to JIT warm up. Did you run that function enough to warm it before taking your timings? This is why micro benchmark frameworks are popular. --Ashton Sent from my iPhone > On Dec 31, 2014, at 7:04 PM, Daniel wrote: > > Th

Re: lazy-seq performance

2014-12-31 Thread Mikera
A few comments: Your two pieces of code aren't really equivalent: a) The Python code is just calculating a fibonacci number in a brute force iterative loop. b) The Clojure code is creating a big (infinite, lazy) data structure of all fibonacci numbers, lazily realising the structure in memory an

Re: lazy-seq performance

2014-12-31 Thread shintotomoe
My results with hotspot 1.7.0_51, clojure 1.7.0-alpha4 are 13s for python and 15s for clojure. I also tested the python version translated to clojure: (defn fib [n] (loop [n n a 0N b 1N] (if (zero? n) a (recur (dec n) b (+ a b) Which was also 15s! I think all the time in the clojure v

Re: How to create a core.async channel that will drop messages if no consumer is currently reading from the channel?

2014-12-31 Thread Laurent PETIT
Hmmm, I'm really not convinced by the answer I gave you ... I hope someone else with better xp than me with core.async (not hard !) will answer to you and correct me. Le lundi 29 décembre 2014, Laurent PETIT a écrit : > Hello, > > I'm still a newbie with core.async myself, but I'll try to answe