Re: Macro to ease multiple-key sorting

2011-12-08 Thread Ray Miller
On 8 December 2011 01:51, Andy Fingerhut andy.finger...@gmail.com wrote: I've been going through the PLEAC web site, writing Clojure examples corresponding to the Perl code examples from the Perl Cookbook: http://pleac.sourceforge.net Michael Bacarella started a github repo to collect these

Re: Dynamically Loading Jar Strategy

2011-12-08 Thread Pierre-Yves Ritschard
Thanks, this clarifies why my initial tests setting the current class loader failed. On Thu, Dec 8, 2011 at 2:14 AM, Brent Millare brent.mill...@gmail.com wrote: To better understand what's going underneath, you're just calling the addURL method of the classloader. But since you might be

Re: re-def a non-dynamic var to a ^:dynamic var make a mistake

2011-12-08 Thread zhi zhu
Thanks Meikel ! It works after I recompile foo. It seems like you are right. :) On Dec 8, 3:28 pm, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: Hi, just a guess: ^:dynmamic is a compile-time thing. foo was compiled without it in place, so the compiler didn't consider it. Recompile foo

Jaki: ClojureScript CouchDB client

2011-12-08 Thread Murphy McMahon
In case anyone is interested in building webapps directly served from CouchDB (Couchapps), I have created a very basic library and build script to facilitate these and it's up on GitHub: https://github.com/pandeiro/Jaki The basic usage is detailed in the README. Now, the disclaimer: I'm brand

Re: Building Clojure applications w/ Maven

2011-12-08 Thread Stuart Sierra
Yes, that Stuart Sierra. Thanks. :) If you want a real Java main method in your compiled Clojure program, you need to define a function in your namespace called -main (with a preceding hyphen) in addition to using (:gen-class) in the ns declaration. -S -- You received this message because

Re: swank-cdt problems

2011-12-08 Thread AndyK
Thank you - I am able to use CDT now. Here's what I had to do... * updated lein plugin to 1.4.0-SNAPSHOT * symlinked to tools.jar in ~/.lein/plugins * added jvm-opts line to project.clj * ran swank using lein swank and M-x slime-connect Problems I still see.. * C-c C-x shortcuts do not work *

Re: Dynamically Loading Jar Strategy

2011-12-08 Thread Brent Millare
Correction, I forgot to add .getParent, the code should be (.addURL (.getParent (.getContextClassLoader (Thread/currentThread))) (.toURL (.toURI file))) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Clojure and large data sets

2011-12-08 Thread Christopher Burke
Hi All, As a newbie I try to read up on Clojure whenever I can. One of the common things that I read is that Clojure is really good for operating on large data sets, but I haven't seen anyone articulate why that is aside from alluding to lazy evaluation. So I assume lazy evaluation is the

Idiomatic pmap for side-effects ?

2011-12-08 Thread Leonel Gayard
Hi, What's the most idiomatic way to execute a function in parallel, if we're only interested in the side effects of the function ? Here's an analogy: a newbie could try to use function f in a for, and it's possible he would not see the side effects of f because of the lazyness of for; in

Re: Macro to ease multiple-key sorting

2011-12-08 Thread Tassilo Horn
Alan Malloy a...@malloys.org writes: Hi Andy Alan, This should be a function, not a macro. In fact it is just: (defn multicmp [ xs] (first (remove zero? xs))) But what you really wanted to begin with is a comparator function, so more like: (defn multicmp [ keys] (fn [a b] (or

java reflection during macro

2011-12-08 Thread Razvan Rotaru
Hi, I'm trying to write some macros for java object instanciation. Here's the code: (defn- gen-object-method [my-class id option value] (let [method (some (java-methods option) (map #(.getName %) (.getMethods my-class)))] (when (not method) (throw (new

Re: java reflection during macro

2011-12-08 Thread Kevin Downey
you can use all the things can use outside of macros: resolve Class/forName etc On Thu, Dec 8, 2011 at 1:06 PM, Razvan Rotaru razvan.rot...@gmail.com wrote: Hi, I'm trying to write some macros for java object instanciation. Here's the code: (defn- gen-object-method [my-class id option

Re: TDD with Leiningen

2011-12-08 Thread Brian Marick
I don't know if you got any answers. If you're not wedded to clojure.test, the examples of Midje here may help: https://github.com/marick/Midje On Dec 1, 2011, at 12:30 AM, Adam Getchell wrote: Hello, I'm porting a scientific application written in SBCL to Clojure. I'd like to do the

Re: TDD with Leiningen

2011-12-08 Thread Kevin Downey
ala carte testing is easy, clojure comes with a testing library called 'clojure.test' the simplest way to test functions is to define tests using deftest, and to assert things using is (use '[clojure.test :only [deftest is]]) (defn foo [x] (+ x 1)) (deftest test-foo ;; deftest creates a var,

Re: TDD with Leiningen

2011-12-08 Thread Jay Fields
My response is similar to Brian's: If you want to try something other than clojure.test, you might like https://github.com/jaycfields/expectations specifically, it plays well with IntelliJ, and gives you an easy way to run all your clojure tests using IntelliJ's built in junit integration.

Re: Clojure and large data sets

2011-12-08 Thread Stuart Sierra
Laziness helps when dealing with large data sets, but it's also tricky to get right. If you mistakenly hold onto the head of a lazy sequence, you block garbage collection on the entire sequence and usually run out of memory. I think Clojure is good for dealing with large data sets for the

Re: Idiomatic pmap for side-effects ?

2011-12-08 Thread Stuart Sierra
doall + pmap will work, but be aware that pmap is not particularly clever about allocating CPU usage. Fork/Join is a better approach, not yet integrated into Clojure proper but there are experimental branches. Also look at `pcalls`. -S -- You received this message because you are subscribed

Re: Clojure and large data sets

2011-12-08 Thread kovas boguta
There are three reasons: 1. Ignoring the big part for now, clojure is good with data in general because its functional, has nice datastructures, and a well designed sequence library. Data manipulation tends to be functional in nature, moreso than general programming (think map-reduce). 2. The

Re: java reflection during macro

2011-12-08 Thread Stuart Sierra
Not sure if it helps, but here's my example of using reflection in a macro: http://stuartsierra.com/2010/12/16/single-abstract-method-macro -S -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Quartz and Clojure

2011-12-08 Thread Jimmy
Great stuff, thanks. On Dec 8, 6:23 am, Lars Rune Nøstdal larsnost...@gmail.com wrote: You've probably found this by now, but there's:https://github.com/mdpendergrass/quartz-clj -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: NW UK Clojurians?

2011-12-08 Thread umbriel
Hello Simon, If it's of interest, there's a Clojure Dojo on the 2nd Monday of every month at Manchester's Madlab: http://manchester.clojuredojo.com/ However, I can't speak from personal experience of this group. It's a bit inconvenient for me, as I'm in Morecambe and dependent upon the dire