Re: Test-driven development in Clojure

2010-10-25 Thread Felix H. Dahlke
n Lazytest, you can use the context objects provided by > lazytest.context.stub. > > -S > > > On Oct 24, 3:03 pm, "Felix H. Dahlke" wrote: > Hi Stuart, > > I just read through this thread again and noticed that I didn't notice > you mentioning th

Re: Test-driven development in Clojure

2010-10-24 Thread Felix H. Dahlke
n using > `binding` to stub out functions within your tests. Lazytest github.com/stuartsierra/lazytest> has explicit support for stubbing > out functions during testing. > > -S > > > On Oct 11, 6:06 pm, "Felix H. Dahlke" wrote: >> Hi, >> >> I&#

Re: Test-driven development in Clojure

2010-10-15 Thread Felix H. Dahlke
d prov]) > > ;; tests > (def loader (loader-rec. :mock (prov-rec. nil nil nil))) > (load-page loader "index.html") > ;; real work > (def loader (loader-rec. :db (prov-rec. "data" "user" "pwd"))) > (load-page loader "index.html") >

Re: Test-driven development in Clojure

2010-10-14 Thread Felix H. Dahlke
fields) and use in function calls. And each > method is a particular responsibility. That's how I think about it, > anyway. > > Either choice should be fine. I write Java interfaces for > implementations in Clojure when I want interop with Java, otherwise I > use multimethods and d

Re: precise numbers

2010-10-13 Thread Felix H. Dahlke
bers /c /such that /a < c < b/. However, there do not >> exist any numbers between 0.9... and 1, thus they must be same number. >> >> As it turns out, it took mathematicians a long time to nail down >> formally exactly what we naively think of as "numbers".

Re: precise numbers

2010-10-13 Thread Felix H. Dahlke
On 13/10/10 22:28, David Sletten wrote: > > On Oct 12, 2010, at 5:44 PM, Brian Hurt wrote: > >> For example, in base 10, 1/3 * 3 = 0.9... > > It may seem counterintuitive, but that statement is perfectly true. > 1 = 0.... > > That's a good test of how well you understand infinity.

Re: Test-driven development in Clojure

2010-10-13 Thread Felix H. Dahlke
I see. So instead of using interfaces and implementations of these, I would simply use closures, one for mock and one for production? That was actually my first attempt, but I didn't like it back then. Take this code for example - passing a function just to have it called feels weird: (defn load-

Re: precise numbers

2010-10-13 Thread Felix H. Dahlke
Nice rant, I learned something here :) I somehow thought BigDecimal wouldn't have any precision issues, but I probably never noticed because I can only think in base-10 arithmetic. Has been good enough for my humble precision problems so far though, never had a notable performance issue with it eit

Re: precise numbers

2010-10-12 Thread Felix H. Dahlke
Um, I meant BigDecimal, not BigInteger. On 12/10/10 18:24, Felix H. Dahlke wrote: > You could use BigInteger, which was created to work around double's > rounding issues - among other things. > > (- 12.305M 12.3049M) > 0.0001M > > On 12/10/10 18:17, cej38 wrote: >&g

Re: Test-driven development in Clojure

2010-10-12 Thread Felix H. Dahlke
The posts and Midje looks pretty interesting, but I'm not sure if I was able to follow, being new to Clojure. I'll give it another try later :) Meanwhile, I've adjourned TDD in my project and wrote some code without it to see if it makes more sense to me that way. I have to say that, although I di

Re: precise numbers

2010-10-12 Thread Felix H. Dahlke
You could use BigInteger, which was created to work around double's rounding issues - among other things. (- 12.305M 12.3049M) 0.0001M On 12/10/10 18:17, cej38 wrote: > I keep running into this type of problem: > > user=> (- 12.305 12.3049) > 9.9976694E-5 > > The computer (probably the

Test-driven development in Clojure

2010-10-11 Thread Felix H. Dahlke
Hi, I'm new to Clojure, using it for a reasonably sized project for the first time, and I'm trying to do test-driven development. While it does work well technically - clojure.test is very nice to use and feels a lot like JUnit 4's assertThat() - I'm wondering if I'm trying to program Java in Cl