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 (filter
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
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
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
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
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 write
On Nov 26, 7:39 pm, Richard Newman holyg...@gmail.com 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
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