Testing - verbosity - method

2009-09-29 Thread Timothy Pratley
I'm after some advice: Firstly I'd like to be able to specify in my tests that sometimes I want extra information reported (when I'm actively working on that module), and sometimes I just want it to do the checks and report ok/ failed. Secondly I'd like to know how to invoke my tests

Re: Testing - verbosity - method

2009-09-29 Thread Michael Wood
2009/9/29 Timothy Pratley timothyprat...@gmail.com: [...] Secondly I'd like to know how to invoke my tests conveniently. Options I've explored: 1) put (run-tests) at the bottom of the file. Great for while I'm coding, bad when including as a library. By the way, this is exactly the sort of

Re: how to understand macro in clojure?

2009-09-29 Thread John Harrop
On Mon, Sep 28, 2009 at 5:23 AM, Jarkko Oranen chous...@gmail.com wrote: What happens is, when you call (mfloat + 1 2) the macro evaluates ('+ (float 1) (float 2)), ie. it calls the *symbol* + with parameters 1.0 and 2.0. Symbols, when used as functions, look themselves up in whatever

Re: Mocking?

2009-09-29 Thread John Harrop
On Mon, Sep 28, 2009 at 9:20 AM, Laurent PETIT laurent.pe...@gmail.comwrote: 2009/9/28 C. Florian Ebeling florian.ebel...@gmail.com In Java I'd just have an interface with two implementations, and bootstrap the tests with a different implementation, in clojure I guess I'd do something

re-sub / re-gsub with back-reference?

2009-09-29 Thread Jung Ko
Does anyone know how I can replace a string with back-reference? I'd like something like this: (use clojure.contrib.str-utils) (re-sub #hello (\S+) , how are you \1? hello Jung) = hello, how are you Jung? Basically I need the back reference \1 to evaluate to Jung in the above case. Is there an

Re: in-smaller-lists

2009-09-29 Thread Travis
Cool, I thought it must exist somewhere, but the 3 3 nil is, although obviously enabling, strange for what I would think should be default behavior. I'll just go ahead and use (def in-smaller-lists #(partition %1 %1 nil %2)) Thanks for the tip. On Sep 25, 8:24 pm, Jeff Valk jv-li...@tx.rr.com

How can I create Java generic classes from Clojure?

2009-09-29 Thread Bob Shock
If I have a Java function that uses ListInteger or MapString,Integer, is there anyway to create these in Clojure the same way I can create vectors or maps? For example, if a function signature is: void foobar(List x, Map y) I can pass standard vectors and maps to it, but I can't figure out how

Re: If you wish to have a version for off-line use...

2009-09-29 Thread Duncan Watts
This worked for me: http://www.mail-archive.com/clojure@googlegroups.com/msg13731.html --~--~-~--~~~---~--~~ 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

Re: Mocking?

2009-09-29 Thread Mark Derricutt
Sadly, even thou my application isn't all that smart I've already fallen into that trap - as my test first launches a Jetty process running a compojure app, and fires http calls at it - with the send-sms call being behind compojure on another thread. I'm thinking a different way of handling

Re: re-sub / re-gsub with back-reference?

2009-09-29 Thread Timothy Pratley
On Sep 29, 8:51 am, Jung Ko koj...@gmail.com wrote: Basically I need the back reference \1 to evaluate to Jung in the above case. Is there an easy way to do this? ; here is one way... user= (format hello, how are you %s? (second (first (re-seq #hello (\S+) hello Jung hello, how are you

Re: How can I create Java generic classes from Clojure?

2009-09-29 Thread Robert Fischer
Since generics are only at compile time, you should be able to pass them straight in via Clojure. What is the specific code that's causing the problem? ~~ Robert Fischer, Smokejumper IT Consulting. Enfranchised Mind Blog http://EnfranchisedMind.com/blog Check out my book, Grails Persistence

ensure Usage

2009-09-29 Thread Volkan YAZICI
Hi, Can anybody give an example to the usage of ensure. I couldn't figure out what exactly it does from its documentation string. Regards. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: ClojureCLR installation?

2009-09-29 Thread Abhishek Reddy
On Tue, Sep 29, 2009 at 2:58 AM, Sean Devlin francoisdev...@gmail.comwrote: 4. Has anyone run ClojureCLR in mono? It still depends on vjslib for BigDecimal: http://github.com/richhickey/clojure-clr/issues#issue/8 I had some luck building ClojureCLR on Mono after ripping out all use of

Re: ensure Usage

2009-09-29 Thread Timothy Pratley
It prevents write skew when you wish to use a non-modified ref as a condition for the transaction to proceed. Here's a nice description: http://clojure.higher-order.net/2009/09/the-write-skew-anomaly/ On Sep 29, 10:32 pm, Volkan YAZICI volkan.yaz...@gmail.com wrote: Hi, Can anybody give an

ClojureCLR and CLR structs

2009-09-29 Thread Shawn Hoover
Updates to local CLR struct instances seem to be lost as soon as they're made. Is this expected? In the test below, function a2 returns the identity matrix despite my attempt to scale it. Function a passes the newly constructed matrix to another function to do the scaling, and it returns the

Re: re-sub / re-gsub with back-reference?

2009-09-29 Thread Stuart Sierra
Hi Jung, Look at clojure.contrib.str-utils2/replace -- you can pass a function as the replacement parameter and make any substitutions you want. -SS On Sep 28, 6:51 pm, Jung Ko koj...@gmail.com wrote: Does anyone know how I can replace a string with back-reference? I'd like something like

Re: Testing - verbosity - method

2009-09-29 Thread Stuart Sierra
On Sep 29, 4:00 am, Timothy Pratley timothyprat...@gmail.com wrote: Secondly I'd like to know how to invoke my tests conveniently. Options I've explored: 1) put (run-tests) at the bottom of the file. Great for while I'm coding, bad when including as a library. 2) at the REPL (load-file

Re: re-sub / re-gsub with back-reference?

2009-09-29 Thread Adrian Cuthbertson
I was just trying out str-utils2 when Stuart posted. Here's an example; (require '[clojure.contrib.str-utils2 :as s]) (s/replace hello Jung #hello (\S+) #(str hello, how are you (% 1))) hello, how are you Jung Rgds, Adrian. On Tue, Sep 29, 2009 at 4:58 PM, Stuart Sierra

Re: 2 upcoming NYC talks

2009-09-29 Thread Brenton
Stuart, Can't make it to New York. It would be great if these talks could be recorded and made available later. I am very interested in what you are doing with Hadoop and also the part about Storage options for Clojure data structures. Thank you, Brenton On Sep 28, 9:20 am, Stuart Sierra

Timing, JIT, Heisen-code

2009-09-29 Thread Matt
Hi. I'm getting a three-fold difference in timing results when I add a seemingly trivial println to observe what's going on. Consider: (defmacro mytime1 Returns execution time of expr in millisecs [expr] `(let [time0# (. System nanoTime) exprval# ~expr time1# (/ (double

RFC: laziness-safe, semi-dynamic environment Var(Lite)

2009-09-29 Thread jon
Hi.. long post.. it's a Request For Comment :) Clojure's thread local binding facility for Vars has always seemed like a useful (but of course misusable) feature to have available in our toolbox.. However it soon becomes apparent that Var bindings don't play nice with laziness - and since

Re: question on last page of Conjure tutorial

2009-09-29 Thread Warren
That worked! Thanks! On Sep 28, 8:18 am, Matt macourt...@gmail.com wrote: Try: code (deftest test-add   (add { :controller controller-name :action add })) /code Let me know if that works. In the tutorial, I guess I should be more clear on what to change. -Matt Courtney On Sep 27,

Re: re-sub / re-gsub with back-reference?

2009-09-29 Thread Jung Ko
Thank you everyone for the tip. It works great. Using s/replace instead of re-sub makes the code much shorter and easier to read. Thanks, Jung Ko On Tue, Sep 29, 2009 at 8:43 AM, Adrian Cuthbertson adrian.cuthbert...@gmail.com wrote: I was just trying out str-utils2 when Stuart posted.

Re: RFC: laziness-safe, semi-dynamic environment Var(Lite)

2009-09-29 Thread Rich Hickey
On Tue, Sep 29, 2009 at 4:04 PM, jon superuser...@googlemail.com wrote: Hi.. long post.. it's a Request For Comment :) Clojure's thread local binding facility for Vars has always seemed like a useful (but of course misusable) feature to have available in our toolbox.. However it soon

Re: ClojureCLR installation?

2009-09-29 Thread David Miller
Shawn is correct across the board. A few additional comments: ClojureBox: - At this point, even an installer would be nice. Someone is working on the automating the build process, including an installer. Any day now. Differences between platforms: - Pure clojure should work with the

Re: Timing, JIT, Heisen-code

2009-09-29 Thread Cliff Wells
On Tue, 2009-09-29 at 09:08 -0700, Matt wrote: So, using mytime2 with the myavgtime macro gives average execution times for the expression (+ 1 2 3) of 2 to 3 times longer than when using mytime1. Why is this? Does the JIT optimize differently with all those println's when using mytime2?

Re: Timing, JIT, Heisen-code

2009-09-29 Thread Meikel Brandmeyer
Hi, On Sep 30, 12:19 am, Cliff Wells cliff.we...@gmail.com wrote: In short, you've taken something that was originally CPU-bound and made it I/O-bound. I don't think so. The measured times do not include the println. The loop with the print will itself run longer, but the average time