Re: Testing functions that access a database

2011-05-08 Thread Shantanu Kumar
On May 8, 8:37 am, Tim McIver wrote: > I'm looking for some input as to the best way to test functions that > interact with a database.  I've just started writing some tests for > functions that read/write to a mysql database (using > clojure.contrib.sql) but my problem is that I'd like the test

Re: Where's incanter chrono?

2011-05-08 Thread Edmund Jackson
I think the code has been under development and is now here: https://github.com/getwoven/clj-time as clj-time. On 8 May 2011, at 05:53, Andreas Kostler wrote: > Hello all, > Has incanter.chrono disappeared? > (use '(incanter core chrono)) > results in > Could not locate incanter/chrono__init.cla

Re: Where's incanter chrono?

2011-05-08 Thread Andreas Kostler
Cheers :) On 08/05/2011, at 8:17 PM, Edmund Jackson wrote: > I think the code has been under development and is now here: > https://github.com/getwoven/clj-time as clj-time. > > On 8 May 2011, at 05:53, Andreas Kostler wrote: > >> Hello all, >> Has incanter.chrono disappeared? >> (use '(incant

Re: Closures in macros

2011-05-08 Thread André Thieme
Hello Ken, thanks for your explanations. It seems that you basically outlined a strategy that can be used to implement that feature. Very good! :-) Am 05.05.2011 02:21, schrieb Ken Wesson: As for concerns that this kind of extension might mask common macro errors, adding some *warn-on-foo* optio

Re: Testing functions that access a database

2011-05-08 Thread Tim McIver
@Ken: I looked into mocking a (very little) bit. I don't have any experience with it but I'm worried about the need to sync the 'real' database with my mocked functions. Using the real schema is appealing because I don't have to worry about synchronization issues. @Shantanu: This looks great! I

Clojure test framework

2011-05-08 Thread Zlatko Josic
Hi, I need to write tests for my Clojure application. Which Clojure test framework would you recommend? I also need posibility to intergrate a framework with Maven. Thanks -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send e

Re: Clojure test framework

2011-05-08 Thread Alex Ott
Standard clojure.test works fine with maven On Sun, May 8, 2011 at 4:29 PM, Zlatko Josic wrote: > Hi, > I need to write tests for my Clojure application. > Which Clojure test framework would you recommend? > I also need posibility to intergrate a framework with Maven. -- With best wishes,     

Re: Clojure test framework

2011-05-08 Thread Ambrose Bonnaire-Sergeant
Midje also works well with Maven. Just wrap them in clojure.test/deftest and you're good to go. Some examples: https://github.com/pallet/stevedore/blob/feature%2Fbatch-impl/test/pallet/stevedore/batch_test.clj And here are almost identical tests, but with clojure.test/is instead of Midje. https:/

Re: Closures in macros

2011-05-08 Thread André Thieme
Am 05.05.2011 02:01, schrieb Ken Wesson: (There's an ugly workaround involving explicitly calling intern; you create a dummy namespace with a var holding the object, and then eval code that refers to that var by fully-qualified name in order to retrieve the object.) Yes, this is what I current

Re: Testing functions that access a database

2011-05-08 Thread Shantanu Kumar
On May 8, 6:57 pm, Tim McIver wrote: > @Ken: I looked into mocking a (very little) bit.  I don't have any > experience with it but I'm worried about the need to sync the 'real' > database with my mocked functions.  Using the real schema is appealing > because I don't have to worry about synchron

How Clojure protocols are implemented internally?

2011-05-08 Thread David Nolen
On Sat, May 7, 2011 at 5:28 PM, Dmitry Kakurin wrote: Let me rephrase my question to avoid unfortunate confusion with standard "count" function: Suppose I have extended my own IMyCountable protocol with a single "mycount" method to String class. What happens when I call (mycount "some string")?

Re: How Clojure protocols are implemented internally?

2011-05-08 Thread Dmitry Kakurin
Very well, something along these lines would be my guess too. But that would mean that in case 2 protocols are no faster than multimethods. And I've got an impression that protocols are described to be as fast as interface dispatch (callvirt). So either my impression is wrong (which is totally po

Re: Testing functions that access a database

2011-05-08 Thread Ken Wesson
On Sun, May 8, 2011 at 12:14 PM, Shantanu Kumar wrote: > On May 8, 6:57 pm, Tim McIver wrote: >> @Ken: I looked into mocking a (very little) bit.  I don't have any >> experience with it but I'm worried about the need to sync the 'real' >> database with my mocked functions.  Using the real schema

If any of you have to code Objective-C...

2011-05-08 Thread Greg S.
I came up with something that might make your life a bit easier (after Clojure exposure): http://www.taoeffect.com/blog/2011/05/better-objective-c-through-clojure-philosophy/ - Greg -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gr

Request for feedback: Tradui

2011-05-08 Thread Andreas Kostler
Hi all, I've started development on tradui, a translator for the Creole markup language. It is not finished or in any deployable shape or form yet, however it's progressed enough to gather some feedback on the approach taken. Please feel free to clone https://github.com/AndreasKostler/tradui.git an

Re: How Clojure protocols are implemented internally?

2011-05-08 Thread David Nolen
On Sun, May 8, 2011 at 4:43 PM, Dmitry Kakurin wrote: > Very well, something along these lines would be my guess too. > But that would mean that in case 2 protocols are no faster > than multimethods. > Not true. > And I've got an impression that protocols are described to be as fast as > interf

Hi, simple problem from a newbie

2011-05-08 Thread iamcreasy
Hi everybody :) I am an experienced C++ programmer. Recently I decided to try out clojure(I have some java experience). I read some tutorials of the basics clojure. Now I want to implement some simple algorithms. Starting with Insertion sort. But, when I have tried to start, I find myself lost.

Re: Testing functions that access a database

2011-05-08 Thread Nick
On 08/05/11 04:54, Ken Wesson wrote: > Have you considered using a mock object in place of the db? I'm curious to know if there are any good examples of SQL mock-object libraries out there - in any language? The kind of thing which deserves to be emulated. I don't get the impression that there ar

Re: Hi, simple problem from a newbie

2011-05-08 Thread Sean Corfield
On Sun, May 8, 2011 at 4:59 PM, iamcreasy wrote: > Hi everybody :) Welcome! > I am an experienced C++ programmer. Recently I decided to try out > clojure(I have some java experience). My background was C++ for most of the 90's then Java for quite a bit of the 00's so I expect you're finding the

clojure.java.jdbc 0.0.1 released

2011-05-08 Thread Sean Corfield
The library formerly known as clojure.contrib.sql has had it's first non-snapshot release. Features added: * returns generated keys for single record inserts * supports naming strategies to allow to override the conversion of keywords to/from SQL entity names * exposes resultset-seq that respect

Order a sequence of maps with {:type :before [types]}

2011-05-08 Thread msappler
I want to order a sequence of maps with keys: obligatory :type optional :before [types]; which means the types should occur before this element in the sequence. I tried to use a custom java.util.Comparator but it only compares adjacent elements. This is my example: (defn- comes-after? "checks

Re: Order a sequence of maps with {:type :before [types]}

2011-05-08 Thread Ken Wesson
On Sun, May 8, 2011 at 10:56 PM, msappler wrote: > I want to order a sequence of maps with keys: > obligatory :type > optional :before [types]; which means the types should occur before > this element in the sequence. That's a quite complex and somewhat difficult problem. First of all, what if y

Equivalent of Cyclic barrier

2011-05-08 Thread MohanR
Is the java.util.concurrent.CyclicBarrier implemented in Clojure using a promise and agents ? I came across some examples like this and I think all threads can use the barrier once using this method. Is there a way to create a reusable Cyclic barrier ? "The barrier is called cyclic because it can

Re: Equivalent of Cyclic barrier

2011-05-08 Thread Alan
None of Clojure's concurrency primitives really support this mode of thinking, as far as I know. If you want a CyclicBarrier (which I doubt you often will, in Clojure), use the perfectly-good, well-tested one in java.util.concurrent. On May 8, 10:13 pm, MohanR wrote: > Is the java.util.concurrent

Reading clojure code of larger domain specific projects

2011-05-08 Thread Christian Schuhegger
Hello list, I have a question that perhaps may be relevant for more people. I strongly believe that reading code of other people is an undervalued discipline of all developers. Typically it just happens as a side effect of working in a project with other people. Like that a style of development ev

Re: Equivalent of Cyclic barrier

2011-05-08 Thread MohanR
Actually I think it is possible. This is actually based on the Java documentation. public class MyCyclicBarrier { private CyclicBarrier barrier; private boolean done = false; class Task implements Runnable { public void run() { while (!done) {