Calculating digits of π (Salamin-Brent)

2009-08-21 Thread jng27
Took a shot at implementing PI in Clojure using a reasonably fast algorithm. So why is it so slow ? Is BigDecimal just that bad ? Would fixed point arithmetic be better using BigInteger ? (MacBook Pro - Intel Core 2 Duo 2.26 GHz - 4GB RAM) (set! *warn-on-reflection* true) (import 'java.lang.Mat

Re: Continuous Integration Builds for Clojure are Back!

2009-08-21 Thread Mark Derricutt
Hrm - I couldn't clone any of the clojure builds as they wer'nt listed, and I see theres no agent that'll build maven2 so my builds just stuck in the queue. I guess the servers only setup to build with ant? -- On Thu, Aug 20, 2009 at 1:13 PM, Howard Lewis Ship wrote: > > Why don't you do the

Re: clojure success story ... hopefully :-)

2009-08-21 Thread Stuart Sierra
On Aug 21, 5:55 pm, Michel Salim wrote: > Is there a performance hit with this style (due to using multimethods) > or will this be optimized away in practice? There is a slight performance penalty over a normal function call. I think the dispatching takes one function call, a hash lookup, and a

Re: clojure success story ... hopefully :-)

2009-08-21 Thread Michel Salim
On Fri, 2009-08-21 at 12:50 -0700, Kevin Downey wrote: > user=> (defmulti length empty?) > #'user/length > > user=> (defmethod length true [x] 0) > # > > user=> (defmethod length false [x] (+ 1 (length (rest x > # > > user=> (length [1 2 3 4]) > 4 > Très cool! This could be applied to Meike

Re: clojure success story ... hopefully :-)

2009-08-21 Thread Meikel Brandmeyer
Hi, Am 21.08.2009 um 20:02 schrieb Sigrid: Could someone point me to what the difference is? I know pattern matching e.g. from the PLT scheme implementation, and there the pattern matching also provides the binding and destructuring I think...? The difference is, that in pattern matching you

Re: clojure success story ... hopefully :-)

2009-08-21 Thread Kevin Downey
user=> (defmulti length empty?) #'user/length user=> (defmethod length true [x] 0) # user=> (defmethod length false [x] (+ 1 (length (rest x # user=> (length [1 2 3 4]) 4 On Fri, Aug 21, 2009 at 12:41 PM, Michel Salim wrote: > > On Fri, 2009-08-21 at 11:02 -0700, Sigrid wrote: >> Hi, >> >

Re: clojure success story ... hopefully :-)

2009-08-21 Thread Michel Salim
On Fri, 2009-08-21 at 11:02 -0700, Sigrid wrote: > Hi, > > I read the related story on InfoQ and found it an extremely > interesting and motivating read, Clojure being applied in such an > interesting field as machine learning! > > There is something in the article I'd like to understand better,

Re: clojure success story ... hopefully :-)

2009-08-21 Thread Sigrid
Hi, I read the related story on InfoQ and found it an extremely interesting and motivating read, Clojure being applied in such an interesting field as machine learning! There is something in the article I'd like to understand better, so i'm just asking here on the group: "The way that Rich elec

Using a map vs. using a metadata map

2009-08-21 Thread samppi
I'm trying to make a decision in a parser library between using regular maps as states (containing a sequence of remaining tokens, as well as other info) vs. using metadata maps attached to the sequence of remaining tokens. In other words: {:remainder [\r \e \m], :index 3, :line 5, :column 2}

Re: replace-subtree for zippers?

2009-08-21 Thread Stefan van der Meer
On Aug 21, 12:05 pm, Jan Rychter wrote: > think crossover in genetic programming (this is actually what I need > this for). > > --J. Hi, I've written a genetic programming framework in Clojure, it might be of interest if you're looking for some inspiration: http://bitbucket.org/svdm/clojuregp/s

Re: read txt file

2009-08-21 Thread tmountain
Just an FYI, you can also use the builtin slurp function, which will return the contents of a given file. (slurp "file.txt") Regards, Travis On Aug 21, 4:11 am, DemAS wrote: > Hi all, > >    I have created the function that read a txt file.  I have a very > little experience in clojure and I w

Re: read txt file

2009-08-21 Thread Meikel Brandmeyer
Hi, On Aug 21, 10:11 am, DemAS wrote: >    I have created the function that read a txt file.  I have a very > little experience in clojure and I will be thankfull for any > correction and ideas. For the record: see (doc line-seq) But here some suggestions, since learning clojure is your main

Re: Eval not working on unexpanded macro quote

2009-08-21 Thread Michel Salim
On Thu, 2009-08-20 at 21:52 -0700, gutzofter wrote: > thanks for the version number: > > Clojure 1.1.0-alpha-SNAPSHOT > > is this from the github? It's from github, yes. The version number is actually a bit meaningless: the 'master' branch on github has been on 1.1.0-alpha-SNAPSHOT ever since 1.

read txt file

2009-08-21 Thread DemAS
Hi all, I have created the function that read a txt file. I have a very little experience in clojure and I will be thankfull for any correction and ideas. This is source code: (defn create-freader [filename] (def f-reader (new java.io.FileReader filename)) f-reader) (defn create-br

Re: replace-subtree for zippers?

2009-08-21 Thread Meikel Brandmeyer
Hi, On Aug 21, 12:05 pm, Jan Rychter wrote: > It isn't what I want. But that's because I misspecified what I actually > wanted. I didn't think about the problem enough. I need something more > akin to a splice function: > > (splice tree1 index tree2) > > (splice '(1 2 (3 4 5) 6) 4 '(7 8 (9 10))

Re: Transcript of Rich's "Clojure for Lispers" talk uploaded

2009-08-21 Thread Lau
Great job doing the transcript! On Aug 13, 10:40 pm, Andy Fingerhut wrote: > This is the same Clojure for Lispers talk with audio, and video of > slides, available on clojure.blip.tv, among others, from the September > 2008 Boston Lisp meeting. > > It has been uploaded to the files section of th

Re: replace-subtree for zippers?

2009-08-21 Thread Jan Rychter
Meikel Brandmeyer writes: > A transcript: > > ; Create trees... > user=> (def t1 [1 [[2 3] 4]]) > #'user/t1 > user=> (def t2 [[[:a :b] :c] :d]) > #'user/t2 > > ; Create zippers and navigate to subtrees... > user=> (def zt1 (-> (zip/vector-zip t1) zip/down zip/right)) > #'user/zt1 > user=> (zip/no

Re: clojure success story ... hopefully :-)

2009-08-21 Thread Jan Rychter
bradford cross writes: > Hi Chad, yep, that was me. We do hope to open source some stuff soon. > > First will probably be our wrappers for cascading/hadoop and s3. Those would be of great interest to many of us. Please do. --J. --~--~-~--~~~---~--~~ You receive

Re: Eval not working on unexpanded macro quote

2009-08-21 Thread Meikel Brandmeyer
Hi, On Aug 21, 8:34 am, gutzofter wrote: > (defmacro macro-hello [] >   `"hello") > > (defn -main [] >   (println (eval '(= 0 0))) ;works >   (println (eval '(com.yourcompany.defpackage/macro-hello))) ;works >   (println (eval `(macro-hello))) ;works >   (println (eval '(macro-hello))) ;does no