Re: Parallel garbage collection worthwhile?

2009-07-29 Thread Daniel Lyons
Hi Seth, On Jul 28, 2009, at 9:16 PM, Seth wrote: I found a simple, worthwhile improvement for a CPU bound implementation of the Sieve of Eratosthenes in Clojure and thought I'd share it. Also attached are a few metrics and code for the curious. So I'm using Clojure to solve some of the

Re: Parallel garbage collection worthwhile?

2009-07-29 Thread Tassilo Horn
Daniel Lyons fus...@storytotell.org writes: Hi Daniel, In your particular case I think you might want to take a look at the source code in the contrib project which implements a lazy list of primes:

Re: Parallel garbage collection worthwhile?

2009-07-29 Thread ataggart
I threw this together, how does it measure up? (defn prime? [x primes] (not (first (filter #(zero? (rem x %)) primes (defn next-prime [xs primes] (lazy-seq (let [xs (drop-while #(not (prime? % primes)) xs) prime (first xs) primes (conj primes prime)] (cons

Re: Confusion with namespaces and SLIME

2009-07-29 Thread martin_clausen
I have had the same experience. I solved it by using (ns ...) and (use separately). /mac On Jul 27, 9:41 pm, Tom Emerson tremer...@gmail.com wrote: Hi all, I'm working with a Clojure file that creates a namespace to include all of its functions: (ns foobar) I load slime and then

Re: Parallel garbage collection worthwhile?

2009-07-29 Thread Seth
That worked pretty well! It completed in about 9 seconds with the default JVM flags. Better yet I switched to the 64bit server 1.6 VM and it completed in 2.9 seconds. Unlike my code, which threw a stack overflow exception. Sigh. I *really* appreciate everyone's friendly and helpful feedback.

Re: Clojure performance tests and clojure a little slower than Java

2009-07-29 Thread Andy Fingerhut
I have added a script that uses the Java version of the benchmark programs to generate the large files that were in the distribution file I gave a link to earlier, so it is much smaller. I've also published it on github and added a COPYING file that makes the licenses more explicit (revised BSD

Re: a denilling macro

2009-07-29 Thread nchubrich
Gentlemen--- Thanks for fixing my newbish error and showing me a better way to do it! Nick. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Java based DocDB

2009-07-29 Thread Niels Mayer
On Mon, Jul 27, 2009 at 7:46 AM, Sean Devlin francoisdev...@gmail.com wrote: Howdy everyone, I've got a project that needs a Doc DB. It will need to run on windows (and probably OS X), so I am looking for something that works with Java. I thought I'd ask for some help here before I

Re: Parallel garbage collection worthwhile?

2009-07-29 Thread John Harrop
On Wed, Jul 29, 2009 at 2:59 AM, Daniel Lyons fus...@storytotell.orgwrote: Probably it would help to try and implement a lazy list of the Fibonacci sequence before looking at that code, and then maybe try some other mathematical sequences that are a little easier to construct too. Using the

fibonacci sequence using lazy-cat

2009-07-29 Thread swaroop belur
Hello all, Just started learning clojure recently - initial examples were easy to understand, until I found this example fibonacci sequence using lazy-cat : (def fibs (lazy-cat [0 1] (map + fibs (rest fibs I am trying to understand how this works ..not sure i fully comprehend it. Can

Re: Parallel garbage collection worthwhile?

2009-07-29 Thread Niels Mayer
FYI, some potentially useful info here: http://n2.nabble.com/Does-JDK6u14-%22Garbage-First-garbage-collector-%28G1%29%22-work-and-or-improve-Xwiki-performance-size-mem-locality--tp2344358p2344358.html Does JDK6u14 Garbage-First garbage collector (G1) work and/or improve Xwiki

Re: Parallel garbage collection worthwhile?

2009-07-29 Thread Christophe Grand
Hi all, I thought about this naive (it considers even numbers!) implementation of the sieve: (defn primes [max] (let [enqueue (fn [sieve n factor] (let [m (+ n factor)] (assoc sieve m (conj (sieve m) factor next-sieve (fn

Re: Emacs clojure mode: how to set current directory classpath

2009-07-29 Thread Luke Amdor
I wrote a emacs macro to help set up different slime implementations for clojure. It has been really helpful. It's at http://github.com/rubbish/rubbish-emacs-setup/blob/ad5bfc6f74cc9f794470e50080f8076b5599fb24/mine/mine-slime.el#L19 I probably should contribute it back to swank-clojure though.

Re: Parallel garbage collection worthwhile?

2009-07-29 Thread Christophe Grand
On Wed, Jul 29, 2009 at 9:49 AM, John Harrop jharrop...@gmail.com wrote: On Wed, Jul 29, 2009 at 2:59 AM, Daniel Lyons fus...@storytotell.orgwrote: Probably it would help to try and implement a lazy list of the Fibonacci sequence before looking at that code, and then maybe try some other

Re: fibonacci sequence using lazy-cat

2009-07-29 Thread Lauri Pesonen
Hi swaroop, 2009/7/29 swaroop belur swaroop.be...@gmail.com: fibonacci sequence using lazy-cat : (def fibs (lazy-cat [0 1]   (map + fibs (rest fibs I am trying to understand how this works ..not sure i fully comprehend it. Can anyone please explain how clojure evaluates this. I'll

a regular expression for matching and for generating?

2009-07-29 Thread Rowdy Rednose
Does anybody know an elegant way to have a regex pattern with capturing groups like in this simple example: user= (def pat #^foo=([^;]*);bar=([^;]*);$) #'user/pat user= (re-seq pat foo=F0o;bar=bAr;) ([foo=F0o;bar=bAr; F0o bAr]) And reuse that pattern to generate a text that replaces the groups

java 1.4 class files

2009-07-29 Thread Frank
Hi there, is it possible to compile clojure source to Java 1.4 class files? If so, how? Thanks Frank --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: fibonacci sequence using lazy-cat

2009-07-29 Thread Baishampayan Ghose
Swaroop, Just started learning clojure recently - initial examples were easy to understand, until I found this example fibonacci sequence using lazy-cat : (def fibs (lazy-cat [0 1] (map + fibs (rest fibs I am trying to understand how this works ..not sure i fully comprehend it.

Re: a regular expression for matching and for generating?

2009-07-29 Thread Stuart Sierra
Look at clojure.contrib.str-utils2/replace. It accepts a function -- the fn will be called on each match, and its return value will be inserted into the result string. But that may not be quite what you want. If you want true string generation, you'd need a template library. -SS On Jul 29,

Re: java 1.4 class files

2009-07-29 Thread Stuart Sierra
The Clojure runtime classes target Java 1.5. Compiled clojure source files still require clojure.jar. So the answer is probably no, it's not possible. -SS On Jul 29, 9:26 am, Frank frakoe.koe...@googlemail.com wrote: Hi there, is it possible to compile clojure source to Java 1.4 class

Re: a regular expression for matching and for generating?

2009-07-29 Thread Chouser
On Wed, Jul 29, 2009 at 9:49 AM, Rowdy Rednoserowdy.redn...@gmx.net wrote: Does anybody know an elegant way to have a regex pattern with capturing groups like in this simple example: user= (def pat #^foo=([^;]*);bar=([^;]*);$) #'user/pat user= (re-seq pat foo=F0o;bar=bAr;)

New JDK 7 Feature: Support for Dynamically Typed Languages in the JVM

2009-07-29 Thread Baishampayan Ghose
Hello, It seems JDK 7 is going to implement JSR 223 which explicitly adds support for Dynamic Programming languages running on the JVM. http://java.sun.com/developer/technicalArticles/DynTypeLang/index.html I would like to know how it will help the Clojure Runtime. Regards, BG --

Re: New JDK 7 Feature: Support for Dynamically Typed Languages in the JVM

2009-07-29 Thread Chouser
On Wed, Jul 29, 2009 at 11:41 AM, Baishampayan Ghoseb.gh...@ocricket.com wrote: Hello, It seems JDK 7 is going to implement JSR 223 which explicitly adds support for Dynamic Programming languages running on the JVM. http://java.sun.com/developer/technicalArticles/DynTypeLang/index.html I

Re: Approaching Clojure-Hibernate integration using hibernate.default_entity_mode = dynamic-map (Feedback Request)

2009-07-29 Thread Shantanu Kumar
Hi Lico, Please find the Hibernate-backed Clojure CRUD-test code here -- http://paste.lisp.org/+1T46 You will notice that I have NOT mentioned default_entity_mode=dynamic- map anywhere in the config. I have simply used the syntax that goes with dynamic map style. You could set that config as

Re: java 1.4 class files

2009-07-29 Thread Daniel Janus
I'd try to first compile Clojure to 1.5 bytecode, then translate it to 1.4 using Retroweaver (http://retroweaver.sourceforge.net/). I don't know whether that'll work, though, since I think the Clojure compiler generates and loads bytecode at runtime. You might need to patch Clojure to somehow

inlining bitwise operations?

2009-07-29 Thread Daniel Janus
Hello, Is there any reason for some of the bitwise functions (bit-and-not, bit-clear, bit-set, bit-flip, bit-test, bit-shift-left and bit-shift- right) not having inline variants? Thanks, Daniel --~--~-~--~~~---~--~~ You received this message because you are

Exit delay from java when lazy?

2009-07-29 Thread mwillson
Hi, I was experimenting with Clojure and XML and stumbled upon a lengthy hang when exiting java which was tracked down to the use of clojure.contrib.lazy-xml. Here's a toy example which exhibits the issue: Script started on Wed Jul 29 15:06:44 2009 [~/dev/clojure]$ cat read-xml-lazy.clj (ns

Re: New JDK 7 Feature: Support for Dynamically Typed Languages in the JVM

2009-07-29 Thread Robert Fischer
It's actually JSR 292 (invoke_dynamic) that's the big news. ~~ Robert. Baishampayan Ghose wrote: Hello, It seems JDK 7 is going to implement JSR 223 which explicitly adds support for Dynamic Programming languages running on the JVM.

Setting-up clojure, clojure-mode and slime with Common-Lisp on Emacs

2009-07-29 Thread Felipe
This is my blog post about how to set up clojure in emacs, using clojure-mode. I hope you enjoy: http://felipero.posterous.com/1446961 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: fibonacci sequence using lazy-cat

2009-07-29 Thread swaroop belur
cool - thanks guys for the detailed reply. crystal clear now -:) Thx swaroop --~--~-~--~~~---~--~~ 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 Note that

Re: Clojure performance degraded

2009-07-29 Thread Baishampayan Ghose
Nico Swart wrote: I recently got clojure source and rebuilt clojure.jar. I noticed that the performance is significantly worse with the new clojure.jar compared to a older clojure.jar. Everything else is the same, I just change the clojure.jar file and the performance is 4x slower. Below the

Re: fibonacci sequence using lazy-cat

2009-07-29 Thread Stuart Halloway
While fibs is a nice small example, it is not idiomatic Clojure. Pointing the fibs var to the head of the list keeps the whole list in memory as it realizes. Better is to expose fibs as a *function* return the sequence, so the head is not retained. (defn fibo [] (map first (iterate (fn

Re: Exit delay from java when lazy?

2009-07-29 Thread Michael Wood
2009/7/29 mwillson cdr@gmail.com: Hi, I was experimenting with Clojure and XML and stumbled upon a lengthy hang when exiting java which was tracked down to the use of clojure.contrib.lazy-xml.  Here's a toy example which exhibits the issue: I haven't looked at

Re: REQUEST: Add seqable? to core

2009-07-29 Thread Chris Kent
I was thinking exactly the same thing. It feels like there should be a better way than instance? ...Sequable. Unless there's a reason that's a bad idea. Chris On Jul 27, 6:49 pm, Sean Devlin francoisdev...@gmail.com wrote: Rich, There have been a few times in this thread that people have

Re: REQUEST: Add seqable? to core

2009-07-29 Thread Chouser
On Mon, Jul 27, 2009 at 1:49 PM, Sean Devlinfrancoisdev...@gmail.com wrote: There have been a few times in this thread that people have tried to determine if a function was seqable, and used the following code (seq? a-collection) While this code is great for determining if a-collection is

Re: REQUEST: Add seqable? to core

2009-07-29 Thread Rich Hickey
On Jul 29, 3:45 pm, Chris Kent cjk...@gmail.com wrote: I was thinking exactly the same thing.  It feels like there should be a better way than instance? ...Sequable.  Unless there's a reason that's a bad idea. There's some discussion here and the linked-to message:

Possible bug report

2009-07-29 Thread Jason Wolfe
Is this a bug? user (eval `(make-array ~Byte/TYPE 2)) ; Evaluation aborted. (ExceptionInInitializerError) Compare: user (eval `(make-array ~Byte 2)) #Byte[] [Ljava.lang.Byte;@26fcfd5c user (eval `(make-array Byte/TYPE 2)) #byte[] [...@1f0feb6e user (make-array (eval Byte/TYPE) 2) #byte[]

Has anyone tried using Clojure with JavaFX?

2009-07-29 Thread samppi
I haven't tried JavaFX much myself, but has anyone tried or thought about using Clojure to manage the logic and data of a JavaFX application yet? What limitations would there be, other than having to compile its Clojure code? --~--~-~--~~~---~--~~ You received this

Re: Clojure performance degraded

2009-07-29 Thread Nico
Baishampayan Ghose wrote: Nico Swart wrote: I recently got clojure source and rebuilt clojure.jar. I noticed that the performance is significantly worse with the new clojure.jar compared to a older clojure.jar. Everything else is the same, I just change the clojure.jar file and the