From Java to Clojure

2009-07-09 Thread Patrik Fredriksson
Hi! I started to look closer at Clojure after Rich Hickey's presentation at QCon London in March, this is my first post. I spend my days programming Java, but my journey as developer did actually start with an ML programming course many years ago. It has been great fun to re-discover the function

Re: From Java to Clojure

2009-07-09 Thread Patrik Fredriksson
d testJavaImpl() { doTestOrderByFreq(new JavaOrderer()); } public void testClojureImpl() { doTestOrderByFreq(new step3.pnehm.ClojureOrderer()); } public void testGroovyImpl() { doTestOrderByFreq(new GroovyOrderer()); } } /Patrik On Thu, Jul 9, 2009 at 3:23 PM, S

Re: From Java to Clojure

2009-07-11 Thread Patrik Fredriksson
Sean Devlin wrote: > If you're running "edge" Clojure, and not 1.0, I'd recommend writing > the tests in Clojure next, using the clojure.test namespace. I'd like to keep it 1.0 for now, so the tests are in clojure.contrib.test-is. But I'll make note, or add an alternative version for clojure.test.

Re: From Java to Clojure

2009-07-11 Thread Patrik Fredriksson
On Fri, Jul 10, 2009 at 3:04 PM, Benjamin Stewart wrote [...] > (defn count-hash-vals [coll] > ;; apply hash-map mapcat was the first thing > ;; I found that worked here... better options ++welcome. >               (apply hash-map >                      (mapcat #(let [[k v] %] >                

OutOfMemoryError with loop/recur

2009-09-18 Thread Patrik Fredriksson
Hi! Could someone please help me understand why the following causes a java.lang.OutOfMemoryError: Java heap space for large n:s (10 works fine, 100 does not). (def integers (iterate inc 1)) (defn limited-reduce [fn coll n] (loop [c coll i n result 0] (if (zero? i) result (rec

Re: OutOfMemoryError with loop/recur

2009-09-18 Thread Patrik Fredriksson
On Sep 18, 10:35 pm, Jarkko Oranen wrote: > On Sep 18, 10:52 pm, Patrik Fredriksson wrote: > > > > > Hi! > > > Could someone please help me understand why the following causes a > > java.lang.OutOfMemoryError: Java heap space for large n:s (10 > > wo

Re: OutOfMemoryError with loop/recur

2009-09-18 Thread Patrik Fredriksson
Hi, On Sep 18, 10:39 pm, Tassilo Horn wrote: > Patrik Fredriksson writes: > > Hi Patrick, > > > > > Could someone please help me understand why the following causes a > > java.lang.OutOfMemoryError: Java heap space for large n:s (10 > > works fine, 10

Re: OutOfMemoryError with loop/recur

2009-09-18 Thread Patrik Fredriksson
On Sep 18, 10:46 pm, John Harrop wrote: > On Fri, Sep 18, 2009 at 4:39 PM, Tassilo Horn wrote: > > > Although that doesn't really help, the normal `reduce' doesn't do > > better. > > > (reduce + (take 100 (iterate inc 1)))  ; works > > (reduce + (take 1000 (iterate inc 1))) ; OutOfMemoryE

Re: Syntax highlighting clojure code

2009-11-03 Thread Patrik Fredriksson
I have used SyntaxHighligter (http://alexgorbatchev.com/) on my blog with the Clojure brush from http://www.undermyhat.org/blog/2009/09/list-of-brushes-syntaxhighligher/ It seems to work fairly well. /Patrik On Nov 3, 9:02 am, Christophe Grand wrote: > pygments (which is used by github) does

Re: getRuntime exec call?

2010-03-19 Thread Patrik Fredriksson
Also, have a look at http://richhickey.github.com/clojure-contrib/shell-api.html /Patrik On Mar 19, 7:00 pm, Michael Gardner wrote: > On Mar 19, 2010, at 6:07 AM, TimDaly wrote: > > > (defn cmdresult [cmdstr] > >  (let [args (into [] (seq (.split cmdstr " ")))] > >  (BufferedReader. > >    (Inpu

Stockholm Clojure User Group

2010-05-26 Thread Patrik Fredriksson
Hi! There is now a Clojure user group in Stockholm, Sweden (via http://twitter.com/peter_hultgren/status/14648902541). Join us at http://groups.google.com/group/stockholm-clojure-user-group /Patrik -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Todo item annotation in Clojure.

2010-05-27 Thread Patrik Fredriksson
Nice! The version at Clojars seems to be missing the Leiningen plugin, could you please upload a new version? Many thanks! /Patrik On May 26, 9:27 pm, Thomas wrote: > Thanks to sids, the project now has lein todo functionality. -- You received this message because you are subscribed to the G

Re: Clojure job scheduler

2011-01-09 Thread Patrik Fredriksson
I have used cron4j in a small project, it's like a more lightweight version of Quartz and fits nicely with Clojure: http://www.sauronsoftware.it/projects/cron4j/ Code example here: https://gist.github.com/388555 /Patrik On Jan 8, 8:37 pm, Trevor wrote: > Thanks, everyone for all you help. > >