Re: overrding function from other namespace

2010-03-20 Thread Martin Hauner
Hi Kevin, On 20 Mrz., 00:34, Kevin Downey redc...@gmail.com wrote: why are you def'ing your functions in the mock namespace? why are you juggling namespaces at all? Because clojure.contrib.mock says so. The only way that worked for me was switching the namespace. Without switching the

Re: overrding function from other namespace

2010-03-20 Thread Martin Hauner
Hi, yes, better than my solution. :) Wrapping the with-bindings around the run-tests I can drop the namespace switch. (with-bindings {#'clojure.contrib.mock/report-problem #'my-report- problem} (run-tests)) The only issue left is that when running the test with leiningen (lein test) I don't

Wrapping a java api...

2010-03-19 Thread Martin Hauner
Hi, I'm trying to wrap the apfloat (arbitrary precision float, http://www.apfloat.org/apfloat_java) java library for a small project. The idea is that the parameters of apfloat calculations get automatically converted to the Apfloat class. My test function is sqrtf (square root float) and the

overrding function from other namespace

2010-03-19 Thread Martin Hauner
Hi, I trying to use clojure.contrib.mock. It says to override the function report-problem to integrate it into other test framework like clojure.test. I've got this working, but the namespace switching looks a bit ugly. Is there a better way to handle this? Maybe something like (ns

Programming Clojure, index-filter when

2010-03-08 Thread Martin Hauner
Hi, there is an example in programming clojure (Chapter 2.6, Where is my for loop? on page 52) that I don't really get. (defn index-filter [pred coll] (when pred (for [[idx elt] (indexed coll) :when (pred elt)] idx))) The explanation in the book explains the for/:when but not the when. ;)

Re: small code review..

2010-02-14 Thread Martin Hauner
Hi Brandon, On 11 Feb., 19:59, Brenton bashw...@gmail.com wrote: Martin, It's very simple, I like it. There two things that stand out to me, both having to do with readabiliby. Instead of using (def score) you should use (declare score). declare exists for the purpose of making forward

Re: small code review..

2010-02-14 Thread Martin Hauner
On 12 Feb., 01:34, Timothy Pratley timothyprat...@gmail.com wrote: On 12 February 2010 03:19, Martin Hauner martin.hau...@gmx.net wrote: I'm mostly interested if there is anything in my code one would/should never do that way. Looks excellent, you've aced it! Thanks :-) I'd like

small code review..

2010-02-11 Thread Martin Hauner
Hi, I'm doing my first steps in Clojure and I would like to get some feedback on my implementation of the Bowling Game Kata. The code is here http://softnoise.wordpress.com/2010/02/07/the-bowling-kata-in-clojure. I can post the code here if that's preferred. I'm mostly interested if there is