Re: Keeping a ref and a DB in sync

2009-04-06 Thread Brian Carper
On Apr 3, 12:42 pm, rzeze...@gmail.com 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

Re: introspect namespace ?

2009-04-06 Thread Adrian Cuthbertson
Nice case of clojure reductio :-) On Mon, Apr 6, 2009 at 7:51 AM, Stephen C. Gilardi squee...@mac.com 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 squee...@mac.com wrote:       (- *ns* ns-name

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

2009-04-06 Thread James Reeves
On Apr 6, 4:10 am, Stuart Sierra the.stuart.sie...@gmail.com wrote: I don't see an obvious way of combining them. What about something like: (defn- normalize-separator [filepath] (.. (str filepath) (replace \\ File/separatorChar) (replace \/ File/separatorChar))) (defn file

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

2009-04-06 Thread Michael Wood
On Mon, Apr 6, 2009 at 10:40 AM, James Reeves weavejes...@googlemail.com wrote: On Apr 6, 4:10 am, Stuart Sierra the.stuart.sie...@gmail.com wrote: I don't see an obvious way of combining them. What about something like: (defn- normalize-separator  [filepath]  (.. (str filepath)    

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

2009-04-06 Thread Jason Sankey
James Reeves wrote: On Apr 6, 4:10 am, Stuart Sierra the.stuart.sie...@gmail.com wrote: I don't see an obvious way of combining them. What about something like: (defn- normalize-separator [filepath] (.. (str filepath) (replace \\ File/separatorChar) (replace \/

lazy seqs (was Re: proposed new contrib: java-utils)

2009-04-06 Thread Stuart Halloway
r652 is a breaking change to contrib. (powers-of-2) and (fibs) are now functions and do not hold their heads. primes is still a sequence because it needs to hold past values for efficiency. Stuart On Apr 5, 2009, at 4:27 PM, Stuart Halloway wrote: At quick glance it looks to me that all

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

2009-04-06 Thread James Reeves
On Apr 6, 11:29 am, Jason Sankey ja...@zutubi.com wrote: I think there may be a misunderstanding over combining here - I read Stuart's mail to mean there was no obvious way to combine duck-streams/file and java-utils/file, whereas this implementation shows java-utils/file style behaviour

Re: No I/O in STM transactions?

2009-04-06 Thread Hugh Winkler
On Mon, Apr 6, 2009 at 12:58 AM, Dex Wood slash2...@gmail.com wrote: 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

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

2009-04-06 Thread Jason Sankey
James Reeves wrote: On Apr 6, 11:29 am, Jason Sankey ja...@zutubi.com wrote: I think there may be a misunderstanding over combining here - I read Stuart's mail to mean there was no obvious way to combine duck-streams/file and java-utils/file, whereas this implementation shows java-utils/file

Re: proposed new contrib: java-utils

2009-04-06 Thread Perry Trolard
Hi Stuart, I had occasion to wrap java.util.Properties. If there's interest, may be a good candidate for c.c.java-utils. It's pasted in below, attached in the group at http://clojure.googlegroups.com/web/props.clj Feel free to change as you see fit. Best, Perry (ns props ;

Re: A syntax feature request: splitting literal strings

2009-04-06 Thread Nathan Kitchen
On Apr 4, 4:16 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: This can be macro-ized: (defmacro bigstr [ strings] Concatenates strings at compile time. (apply str strings)) user (macroexpand-1 '(bigstr This is a really long string that I just felt

Re: A syntax feature request: splitting literal strings

2009-04-06 Thread Laurent PETIT
2009/4/6 Nathan Kitchen nathan.kitc...@gmail.com On Apr 4, 4:16 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: This can be macro-ized: (defmacro bigstr [ strings] Concatenates strings at compile time. (apply str strings)) user (macroexpand-1 '(bigstr This is a really

Re: A syntax feature request: splitting literal strings

2009-04-06 Thread Laurent PETIT
2009/4/4 samppi rbysam...@gmail.com I don't really want it so much for documentation strings—they're already formatted in a standard way [...] Well, they certainly are formatted in *a* standard way :-), e.g. they have a hard-coded formatted only suitable as-is for 80 columns wide terminals

Re: How do you handle different string encodings?

2009-04-06 Thread Daniel Jomphe
I finally worked it all out. For future reference, here's a record of my research on this: http://stackoverflow.com/questions/715958/how-do-you-handle-different-string-encodings Daniel Jomphe wrote: I made some progress. [By the way, NetBean's console displays *everything* 100% fine.  I

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

2009-04-06 Thread Victor Rodriguez
Hello, On Mon, Apr 6, 2009 at 10:06 AM, James Reeves weavejes...@googlemail.com wrote: ... The problem with having java-utils/file and duck-streams/file is that you lose the ability to load both namespaces at the same time without defining an exception for the file function. This does not

Simple dosync/alter question

2009-04-06 Thread bgray
I have a some what (I believe) easy question. Could someone let me know what I'm doing wrong? A simplified version of what I'm trying to do looks like this: user= (def foo (ref 0)) #'user/foo user= (defn square [x] (* x x)) #'user/square user= (defn square-ref [x] (dosync (alter foo square

Re: Simple dosync/alter question

2009-04-06 Thread Paul Stadig
Alter expects a function that take the current value of the ref it will alter as the first arg. I think what you want to do is ref-set. user= (doc alter) - clojure.core/alter ([ref fun args]) Must be called in a transaction. Sets the in-transaction-value of ref to:

Re: Simple dosync/alter question

2009-04-06 Thread David Nolen
I think what you want is: (def foo (ref 0)) (defn square [x] (* x x)) (defn square-ref [x] (dosync (ref-set foo (square x (square-ref 2) On Mon, Apr 6, 2009 at 3:02 PM, bgray graybran...@gmail.com wrote: I have a some what (I believe) easy question. Could someone let me know what I'm

Re: ANN: Pretty printer is now part of contrib

2009-04-06 Thread Tom Faulhaber
There are a bunch of things in the build file that do nothing without complaining when clojure.jar isn't set. I didn't want to make a radical change to the build file with this checkin but I didn't want users to not get the pretty printer and wonder why either. More generally, I think we need

Re: Simple dosync/alter question

2009-04-06 Thread David Sletten
On Apr 6, 2009, at 9:02 AM, bgray wrote: I have a some what (I believe) easy question. Could someone let me know what I'm doing wrong? A simplified version of what I'm trying to do looks like this: user= (def foo (ref 0)) #'user/foo user= (defn square [x] (* x x)) #'user/square

Experiments in unit testing

2009-04-06 Thread James Reeves
Hi folks, A while ago I started writing a unit testing library called Fact that was a cross between Haskell's QuickCheck, and Ruby's RSpec. I've done a lot of work with it, and some people might conceivably be interested in how I got on with it, so this post is to chart what I found whilst

Re: Clojure, Android and Emacs on Ubuntu tutorials

2009-04-06 Thread Nick Levine
I've been trying to get Clojure/Android up and running today. The pure java example in http://riddell.us/tutorial/android/android.html works fine. I tried the hello world example as in http://riddell.us/tutorial/clojure_android/clojure_android.html and get the following message from the

clojure + android

2009-04-06 Thread Nick Levine
Apologies for what might be multiple postings. Looks like google swallowed the first one without chewing. I've been trying to get clojure + android going but without much success. In case it's relevant, I'm on Windows (XP) and the java version is 1.6.0_13. I followed

keyword and /

2009-04-06 Thread Andrew Rimes
Hello, This tripped me up today: user= (:the/key { :the/key the val}) ; ok the val user= (:the/key { (keyword the/key) the val}) ; returns nil? nil Shouldn't both return the val? Thanks, Andrew --~--~-~--~~~---~--~~ You received this message because you are

Re: keyword and /

2009-04-06 Thread Stephen C. Gilardi
The call to keyword here: user= (:the/key {(keyword the key) the val}) the val creates a keyword whose namespace part is the and whose name part is key just like :the/key. Does this accomplish what you're after or are you specifically requesting that (keyword the/key) be

Re: keyword and /

2009-04-06 Thread Andrew Rimes
On 6-Apr-09, at 6:22 PM, Stephen C. Gilardi wrote: The call to keyword here: user= (:the/key {(keyword the key) the val}) the val creates a keyword whose namespace part is the and whose name part is key just like :the/key. Does this accomplish what you're after or are you

New release of the enclojure plugin is up.

2009-04-06 Thread Eric Thorsen
There is a new release of the Enclojure plugin that addresses many of the items I have seen discuss here recently with regards to managing classpaths in REPLs as well as many other Clojure development scenarios. The plugin supports several use cases for the clojure.main REPL use: a. Project

Re: clojure + android

2009-04-06 Thread Onorio Catenacci
On Apr 6, 12:28 pm, Nick Levine n...@ravenbrook.com wrote: Apologies for what might be multiple postings. Looks like google swallowed the first one without chewing. I've been trying to get clojure + android going but without much success. In case it's relevant, I'm on Windows (XP) and the

Re: clojure + android

2009-04-06 Thread Onorio Catenacci
On Apr 6, 12:28 pm, Nick Levine n...@ravenbrook.com wrote: Apologies for what might be multiple postings. Looks like google swallowed the first one without chewing. I've been trying to get clojure +androidgoing but without much success. In case it's relevant, I'm on Windows (XP) and the java

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

2009-04-06 Thread samppi
In addition, it's a bad idea to have these two superficially similar functions have the same name, file. If, in the end, both are to be kept public, then I think they should at least be given different names. On Apr 6, 10:35 am, Victor Rodriguez vict...@gmail.com wrote: Hello, On Mon, Apr 6,

Re: ANN: Pretty printer is now part of contrib

2009-04-06 Thread Laurent PETIT
Hi, 2009/4/6 Tom Faulhaber tomfaulha...@gmail.com Another question is whether we should duplicate the classes and the .clj files in the jar or should we just compile all of them. Is there some value to having the source there? There certainly some value for both scenario : having classes

Re: New release of the enclojure plugin is up.

2009-04-06 Thread billh04
I downloaded and installed NetBeans and the Enclojure plugin. I am not clear on how to setup the main class. I modified the main class generated by the template to look like the following: = (defn -main ([args] (startNewAchiTask)) ([ ] (-main nil)))