Re: introspect namespace ?

2009-04-05 Thread Adrian Cuthbertson
Nice case of clojure reductio :-) On Mon, Apr 6, 2009 at 7:51 AM, Stephen C. Gilardi wrote: > (str *ns*) > > On Apr 6, 2009, at 1:27 AM, Kevin Downey wrote: > >> (.toString *ns*) >> >> On Sun, Apr 5, 2009 at 12:39 PM, Stephen C. Gilardi >> wrote: >>> >>> >>>       (-> *ns* ns-name name) > --~-

Re: Keeping a ref and a DB in sync

2009-04-05 Thread Brian Carper
On Apr 3, 12:42 pm, "rzeze...@gmail.com" wrote: > Brian, I imagine you are asking this in relation to your blog engine? Yep. Thanks everyone for the help and ideas. Unfortunately I do have a ton of data in a DB already so Terracotta would be a lot of work. I rewrote everything to do ref updat

Re: No I/O in STM transactions?

2009-04-05 Thread Dex Wood
If you want to do I/O from a transaction, just use an agent to do the I/O. Since the agent is only sent off at commit, you don't have to worry about retries. This doesn't answer your questions about idempotent I/O, but I think it is a strategy that you can use. On Apr 5, 2:11 pm, Hugh Winkler

Re: introspect namespace ?

2009-04-05 Thread Stephen C. Gilardi
(str *ns*) On Apr 6, 2009, at 1:27 AM, Kevin Downey wrote: (.toString *ns*) On Sun, Apr 5, 2009 at 12:39 PM, Stephen C. Gilardi wrote: (-> *ns* ns-name name) smime.p7s Description: S/MIME cryptographic signature

Re: introspect namespace ?

2009-04-05 Thread Kevin Downey
(.toString *ns*) On Sun, Apr 5, 2009 at 12:39 PM, Stephen C. Gilardi wrote: > > On Apr 5, 2009, at 3:23 PM, dysinger wrote: > >> I need coffee - too many typos.  I meant to say "I am trying to avoid >> _typing_ 'x.y.z' twice" >> >> (str (the-ns 'user)) is is even more human-error prone than just

ANN: Pretty printer is now part of contrib

2009-04-05 Thread Tom Faulhaber
By (semi-)popular demand, I have added the pretty printer and the Common Lisp format function (which are really the same package) into clojure.contrib. It all lives in the namespace clojure.contrib.pprint. Important: If you want to use pretty printing, you will have to compile all the source code

Re: DISCUSS: clojure.contrib.java-utils/file

2009-04-05 Thread Stuart Halloway
Good summary. Let's keep them separate until we feel pain. - Stuart Halloway > They work rather differently. duck-streams/file treats all arguments > as strings, so > (file "foo" "bar") => > I wrote it that way because I often want to construct a file name like > (file base "." extension) >

Re: DISCUSS: clojure.contrib.java-utils/file

2009-04-05 Thread Stuart Sierra
They work rather differently. duck-streams/file treats all arguments as strings, so (file "foo" "bar") => I wrote it that way because I often want to construct a file name like (file base "." extension) java-utils/file is closer to the Java File interface, by assuming that each argument is a

clojure.main always exits with code 0

2009-04-05 Thread John D. Hume
Earlier today I was surprised to notice that some test-is unit tests I was running from Ant failed, but it still reported BUILD SUCCESSFUL. I figured I'd forgotten to include failonerror="true" in the java task, but it was there. So I played around and found that $ java -cp clojure.jar clojure.ma

Re: ant + ivy IMO is not simpler than POMs

2009-04-05 Thread Jason Sankey
dysinger wrote: > It's good to see other examples of dep management for other setups. > > However, IMO working on 20 modules would be a PITA with ant+ivy. Can > you show an example with multi-module? (I tried checking out the > latest release of IVY and it wouldn't compile on my Mac w/ JDK 1.6 so

Re: Problem with CLASSPATH

2009-04-05 Thread dlb
I have the same problem on my Mac as well, i.e. if clojure.jar is loaded from ~/Library/Java/Extensions rather than from the classpath, then clojure does not find files on the classpath. I did some poking around and on my Mac OS X 10.5.6 with Java 6. When I start clojure with clojure.jar only o

Re: DISCUSS: clojure.contrib.java-utils/file

2009-04-05 Thread James Reeves
I'd like it if they were combined. You could then use (file "foo/bar") or (file "foo" "bar"). - James On Apr 5, 9:25 pm, Stuart Halloway wrote: > Doh! Missed that. The duck-streams and java-utils versions of file   > have overlapping but disjoint functionality. Other-Stuart, I can take   > a lo

Re: DISCUSS: clojure.contrib.java-utils/with-system-properties

2009-04-05 Thread Shawn Hoover
I was wondering if anyone would ever need this functionality. Knock yourself out. In retrospect a map is definitely the way to go. Shawn On Sun, Apr 5, 2009 at 12:36 PM, Stuart Halloway wrote: > Don't work with the yucky properties API, just install a map of properties > for the duration of a bl

Re: Possible bug in proxy: NPE for unqualified class

2009-04-05 Thread Paul Drummond
2009/4/3 Rich Hickey : > Could you please submit an issue for that one? No problem: http://code.google.com/p/clojure/issues/detail?id=102 Thanks, Paul. -- Iode Software Ltd, registered in England No. 6299803. Registered Office Address: 12 Sancroft Drive, Houghton-le-Spring, Tyne & Wear, DH5 8N

Reflection warning with source path [patch]

2009-04-05 Thread Toralf Wittner
Dear list members, When I recently turned on reflection warnings, I missed source path information (i.e. filenames) because warnings will include referenced modules. It would be nice to be able to differentiate from the output where each warning belongs to, e.g. instead of Reflection warning, lin

Re: proposed new contrib: java-utils

2009-04-05 Thread Stephen C. Gilardi
On Apr 5, 2009, at 4:27 PM, Stuart Halloway wrote: At quick glance it looks to me that all three of the lazy-seqs should be functions. If you want me to I'll change this and add tests. Please do. Thanks. --Steve smime.p7s Description: S/MIME cryptographic signature

Re: DISCUSS: clojure.contrib.java-utils/the-str

2009-04-05 Thread Stephen C. Gilardi
On Apr 5, 2009, at 4:21 PM, Stuart Halloway wrote: No -- the intended change was from multiple :use forms to one :use form with multiple namespaces. Any indentation changes outside of that were unintentional--let me know if I am violating conventions. Thanks. I have a convention of indenting

Re: proposed new contrib: java-utils

2009-04-05 Thread Stuart Halloway
> I'd also like to get your latest thinking on your suggestions from > some time ago about clojure.contrib.lazy-seqs. If they can be > rewritten as you suggested as functions that return a new sequence > rather than as "def'd" sequences, that's strictly more powerful and > would be an impr

Re: DISCUSS: clojure.contrib.java-utils/file

2009-04-05 Thread Stuart Halloway
Doh! Missed that. The duck-streams and java-utils versions of file have overlapping but disjoint functionality. Other-Stuart, I can take a look at combining these, or we can just leave them separate for now. --Stuart > On Apr 5, 5:07 pm, Stuart Halloway wrote: >> Never worry about "foo" vs.

Re: DISCUSS: clojure.contrib.java-utils/the-str

2009-04-05 Thread Stuart Halloway
> I noticed the indentation changed for the ns form with your changes > to sql.clj sql/internal.clj . Is the indentation you used produced > by some tool? > > --Steve No -- the intended change was from multiple :use forms to one :use form with multiple namespaces. Any indentation changes ou

Re: ant + ivy IMO is not simpler than POMs (was: ant + ivy)

2009-04-05 Thread Krešimir Šojat
Hi, > Can > you show an example with multi-module? (I tried checking out the > latest release of IVY and it wouldn't compile on my Mac w/ JDK 1.6 so > I didn't get far.) Look at http://bitbucket.org/ksojat/neman/src/, it is ivy+ant based, multi module setup with custom javascript task for clojur

Re: No I/O in STM transactions?

2009-04-05 Thread Stephen C. Gilardi
On Apr 5, 2009, at 3:11 PM, Hugh Winkler wrote: From http://clojure.org/refs : "I/O and other activities with side-effects should be avoided in transactions, since transactions will be retried. The io! macro can be used to prevent the use of an impure function in a transaction." Isn't it

Re: introspect namespace ?

2009-04-05 Thread Stephen C. Gilardi
On Apr 5, 2009, at 3:23 PM, dysinger wrote: I need coffee - too many typos. I meant to say "I am trying to avoid _typing_ 'x.y.z' twice" (str (the-ns 'user)) is is even more human-error prone than just typing "user". I was look for a way to introspect ns (DRY up the Logger/getLogger call).

Re: introspect namespace ?

2009-04-05 Thread dysinger
I need coffee - too many typos. I meant to say "I am trying to avoid _typing_ 'x.y.z' twice" (str (the-ns 'user)) is is even more human-error prone than just typing "user". I was look for a way to introspect ns (DRY up the Logger/getLogger call). In java you could just Logger.getLogger(this.ge

Re: introspect namespace ?

2009-04-05 Thread dysinger
I am trying to avoid tying "x.y.z" twice it the above code. On Apr 5, 8:49 am, "Stephen C. Gilardi" wrote: > Is this what you're looking for: > >         user=> (doc the-ns) >         - >         clojure.core/the-ns >         ([x]) >           If passed a namespace, retur

No I/O in STM transactions?

2009-04-05 Thread Hugh Winkler
Hi all, >From http://clojure.org/refs : "I/O and other activities with side-effects should be avoided in transactions, since transactions will be retried. The io! macro can be used to prevent the use of an impure function in a transaction." Isn't it OK to do I/O in a transaction as long as doing

Re: ant + ivy IMO is not simpler than POMs (was: ant + ivy)

2009-04-05 Thread dysinger
It's good to see other examples of dep management for other setups. However, IMO working on 20 modules would be a PITA with ant+ivy. Can you show an example with multi-module? (I tried checking out the latest release of IVY and it wouldn't compile on my Mac w/ JDK 1.6 so I didn't get far.) >From

Re: introspect namespace ?

2009-04-05 Thread Stephen C. Gilardi
Is this what you're looking for: user=> (doc the-ns) - clojure.core/the-ns ([x]) If passed a namespace, returns it. Else, when passed a symbol, returns the namespace named by it, throwing an exception if not fou

introspect namespace ?

2009-04-05 Thread dysinger
How can I introspect namespaces? I can once I have some definitions going it seems but not before (I am noob). See below example: (ns x.y.z (import '(java.util.logging Logger))) (def log (Logger/getLogger "x.y.z")) ;; <-- how-to introspect this ns ? (.addHandler log (FileHandler. (format "/va

Re: DISCUSS: clojure.contrib.java-utils/the-str

2009-04-05 Thread Stephen C. Gilardi
On Apr 5, 2009, at 12:19 PM, Stuart Halloway wrote: (2) This function is moved from Steve Gilardi's sql.internal contrib. (Steve, I broke sql in r636 but I think I fixed it now. Are there tests I can run?) Nothing automated yet. I use clojure.contrib.sql.test and then (db- write) (db-read) a

DISCUSS: clojure.contrib.java-utils/with-system-properties

2009-04-05 Thread Stuart Halloway
Don't work with the yucky properties API, just install a map of properties for the duration of a block! - clojure.contrib.java-utils/with-system-properties ([settings & body]) Macro setting => property-name value Sets the system propertie

Re: A clojure server

2009-04-05 Thread christ...@mvonessen.de
On Apr 5, 5:39 pm, Christian von Essen wrote: > On Sat, Apr 04, 2009 at 11:50:57PM +0200, Meikel Brandmeyer wrote: > > I'm haven't tried, yet. But the gensymed namespace certainly will > > get in the way, since VimClojure relies on the namespace not > > going away between the runs, since there is

Re: DISCUSS: clojure.contrib.java-utils/the-str

2009-04-05 Thread James Reeves
In Compojure, I called this str*, but I think I like as-str a little better. - James On Apr 5, 5:19 pm, Stuart Halloway wrote: > Never worry about the distinction between symbols, keywords, and   > strings when working with Java APIs that know only strings! > >   (doc the-str) > ---

Re: DISCUSS: clojure.contrib.java-utils/file

2009-04-05 Thread James Reeves
On Apr 5, 5:07 pm, Stuart Halloway wrote: > Never worry about "foo" vs. (File. "foo") again! > > (doc file) > - > clojure.contrib.java-utils/file > ([arg] [parent child] [parent child & more]) >    Returns a java.io.File from string or file args. > > Notes: > > (1) You w

DISCUSS: clojure.contrib.java-utils/the-str

2009-04-05 Thread Stuart Halloway
Never worry about the distinction between symbols, keywords, and strings when working with Java APIs that know only strings! (doc the-str) - clojure.contrib.java-utils/the-str ([x]) Returns the name or string representation of x Notes: (1) You will need to build c

DISCUSS: clojure.contrib.java-utils/file

2009-04-05 Thread Stuart Halloway
Never worry about "foo" vs. (File. "foo") again! (doc file) - clojure.contrib.java-utils/file ([arg] [parent child] [parent child & more]) Returns a java.io.File from string or file args. Notes: (1) You will need to build contrib from source to see this. (2) This fu

Re: A clojure server

2009-04-05 Thread Christian von Essen
On Sat, Apr 04, 2009 at 11:50:57PM +0200, Meikel Brandmeyer wrote: > I'm haven't tried, yet. But the gensymed namespace certainly will > get in the way, since VimClojure relies on the namespace not > going away between the runs, since there is no continuous > connection between Vim and the server.

Re: A clojure server

2009-04-05 Thread Christian von Essen
On Sat, Apr 04, 2009 at 09:56:00PM +0200, Konrad Hinsen wrote: > I tried to install your server, but I got stuck with the posix > package. There are no installation instructions, and from looking at > the Makefile it seems like I need to provide information about my JVM > that I don't know w

Re: [ANN] clojuredev 0.0.30 released

2009-04-05 Thread Laurent PETIT
Ooops, here it is, the documentation page : http://code.google.com/p/clojure-dev/wiki/Documentation First 2 chapters are about prerequisites and installation, Regards, -- Laurent 2009/4/5 Brian Doyle > If I wanted to download and play with clojuredev where would I find it? > > On Sat, Apr 4

Re: [ANN] clojuredev 0.0.30 released

2009-04-05 Thread Brian Doyle
If I wanted to download and play with clojuredev where would I find it? On Sat, Apr 4, 2009 at 3:58 PM, Laurent PETIT wrote: > > New release, with a lot of changes! > > I would particularly like to thank Stephan Mühlstrasser for his > contributions ! > The clojure symbols omni-completion feature

ant + ivy (was: Re: Ironicly Maven2 is the lightest I could come up with)

2009-04-05 Thread Meikel Brandmeyer
Hello Jason, Am 03.04.2009 um 14:18 schrieb Jason Warner: I'd be interested in seeing the ivy+ant solution. We use maven2 at work and there are obvious pros and cons. With clojure, part of the pain is initial setup and config. Maven2/ant+ivy might really help that. Post when you get a chance..

Re: Nested loops

2009-04-05 Thread Meikel Brandmeyer
Hi, Am 05.04.2009 um 06:59 schrieb David Sletten: My example is decidedly non-functional (I don't really like that term...My code works--it does function! :-) ). Maybe one should use non-functional for - well - non-functional code and disfunctional for not working code? I was more curious