Re: performance issues with multi-dimensional array

2009-11-26 Thread David Nolen
Check out this thread: http://groups.google.com/group/clojure/browse_frm/thread/4c52d4c3c19201b6/dd80d5e5bde4dc61 On Thu, Nov 26, 2009 at 4:49 AM, Amnon wrote: > I did, and it works like a charm. Couldn't figure out how to hint an > array of objects (what should I put instead of the old #^object

Re: performance issues with multi-dimensional array

2009-11-26 Thread Amnon
I did, and it works like a charm. Couldn't figure out how to hint an array of objects (what should I put instead of the old #^objects? I still get it to work in 300 ms (which is not great but something I can live with). Thanks for the replies, On Nov 25, 8:01 pm, David Nolen wrote: > Read Christo

Re: A Clojure Highlife

2009-11-26 Thread Chris Jenkins
Thanks for sharing this. Coincidentally, I just wrote my first Clojure program which was... an implementation of Conway's Game of Life :-) I took a different approach - I represented the board as a vector of vectors of integers (1 for alive, 0 for dead) and then implemented a new-board function tha

Re: Question about future

2009-11-26 Thread John Harrop
On Thu, Nov 26, 2009 at 2:11 AM, Christophe Grand wrote: > On Thu, Nov 26, 2009 at 8:05 AM, Robert Campbell wrote: > >> If you have this: >> >> user> (def f (future (Thread/sleep 2) :done)) >> #'user/f >> user> @f ; this immediate deref blocks for 20 sec, finally returning >> :block >> :done

Re: Atomic reloads and snapshots of namespaces

2009-11-26 Thread pmf
On Nov 26, 7:39 pm, Richard Newman wrote: > "Re consistency: I seem to recall Pascal Costanza working on   > activation of layers, so you can swap a whole set of stuff across your   > program. He spoke about it at ILC2009, but I'm not sure I've found the   > right paper. Common Lisp-specific, thou

Re: Space leak with lazy sequences.

2009-11-26 Thread David Brown
On Thu, Nov 26, 2009 at 05:05:17PM -0800, David Brown wrote: >On Thu, Nov 26, 2009 at 04:00:34PM -0800, David Brown wrote: > >>For now, I'll do without the with-open, since in this particular case, >>errors are going to be fairly fatal anyway. > >BTW, I still haven't been able to figure out how to

Re: Space leak with lazy sequences.

2009-11-26 Thread David Brown
On Thu, Nov 26, 2009 at 04:00:34PM -0800, David Brown wrote: >For now, I'll do without the with-open, since in this particular case, >errors are going to be fairly fatal anyway. BTW, I still haven't been able to figure out how to write this function without hanging onto the collection across the

Re: Space leak with lazy sequences.

2009-11-26 Thread David Brown
On Thu, Nov 26, 2009 at 02:50:09PM -0800, David Brown wrote: >I'm writing some fairly complex code involving lazy sequences. I >appear to be getting a space leak from what looks like something that >is still holding a reference to the head of the sequence. Ok, I found the leak. I guess I'd call

Space leak with lazy sequences.

2009-11-26 Thread David Brown
I'm writing some fairly complex code involving lazy sequences. I appear to be getting a space leak from what looks like something that is still holding a reference to the head of the sequence. Does anyone have any advice on how to go about finding this? Are there any JVM tools that might perchan

Re: Atomic reloads and snapshots of namespaces

2009-11-26 Thread Richard Newman
> 2) And even if we can manage point 1) there is still the problem > with atomicity. Or not? > I imagine a chain of n functions. Callers or callees may expect > different args. I would like to update the whole namespace as > one unit. Maybe this already works in Clojure? There was a discussion on

Re: Atomic reloads and snapshots of namespaces

2009-11-26 Thread Anniepoo
I would appreciate, in a similar vein, an amplification of the "Use with caution" advice in the api docs for remove-ns. I'd like to use remove-ns but am reluctant to architect a system around a function marked 'use with caution' (remove-ns sym) Removes the namespace named by the symbol. Use with

Atomic reloads and snapshots of namespaces

2009-11-26 Thread André Thieme
My web application needs updates from time to time. When this happens I often have to stop the server and shut down the JVM. Then the old (current) directories can be replaced by the new ones, and I restart the server. It's okay when there are several copies of the server running behind a load bal

Re: FileNotFoundException (Access is denied)

2009-11-26 Thread Robert Campbell
Thank you, that was the problem. I wonder if Stuart should change this line: (defn clojure-source? [file] (.endsWith (.toString file) ".clj" )) to this: (defn clojure-source? [file] (and (.isFile file) (.endsWith (.toString file) ".clj" ))) just to make sure directories like "myproj.clj" don't

Re: FileNotFoundException (Access is denied)

2009-11-26 Thread Rob Wolfe
Robert Campbell napisał(a): > I'm trying to write a file scanner very similar to the one on page 131 > of Stuart's book: > > (ns user > (:use [clojure.contrib.duck-streams :only [reader]])) > > (defn scan [dir] > (for [file (file-seq dir)] > (with-open [rdr (reader file)] > (count (