alter atom while iterating

2010-07-11 Thread Jeffrey Schwab
Is it safe to alter an atom while iterating that atom's value? It seems to work as I would expect, but am I just getting lucky (and are there concurrency issues)? user=> (let [a (atom #{1 2 3 4 5})] (doseq [x @a] (prn @a) (swap! a disj x))) #{1 2 3 4 5} #{2 3 4 5} #{3 4 5} #{4 5} #{5}

Re: alter atom while iterating

2010-07-11 Thread Jeffrey Schwab
On 7/11/10 8:43 AM, James Reeves wrote: On 11 July 2010 12:38, Jeffrey Schwab wrote: Is it safe to alter an atom while iterating that atom's value? user=> (let [a (atom #{1 2 3 4 5})] (doseq [x @a] (prn @a) (swap! a disj x))) Whenever you deref an atom (using @)

Re: alter atom while iterating

2010-07-11 Thread Jeffrey Schwab
On 7/11/10 9:52 AM, Stuart Halloway wrote: Thanks. What I'm having trouble with is not the reference vs. value semantics, but the order of evaluation. Clojure seems to be all over the map on this; it's probably not as bad as it looks, but I'm accustomed to either purely strict or purely lazy

Re: alter atom while iterating

2010-07-11 Thread Jeffrey Schwab
On 7/11/10 9:08 PM, MichaƂ Marczyk wrote: On 12 July 2010 02:37, Jeffrey Schwab wrote: I did not know whether the sequence expressions (the right halves of the binding-forms) were evaluated strictly, or re-evaluated on each pass (like the body-expr). They are apparently evaluated a priori

Re: Clojure 1.2 Beta 1

2010-07-15 Thread Jeffrey Schwab
Is Clojure 1.2 Beta 1 built from the current clojure.git head on github? I don't see any 1.2 branches or tags, and the repl prints the following: Clojure 1.2.0-master-SNAPSHOT I also don't see any commits since 6/23; is that right? Thanks and congratulations, btw. :) On 7/14/10 11:35 AM, St

Re: Clojure 1.2 Beta 1

2010-07-15 Thread Jeffrey Schwab
On 7/15/10 9:24 AM, nickikt wrote: the new branch is called clojure not master Thanks, but I see no branch by that name. Do you mean 1.2.x? (And what's the corresponding branch for clojure-contrib?) -- You received this message because you are subscribed to the Google Groups "Clojure" gro

Re: Clojure 1.2 Beta 1

2010-07-15 Thread Jeffrey Schwab
On 7/15/10 10:15 AM, Adrian Cuthbertson wrote: Apparently there's a problem with git clone http://... Should be git clone git://github.com/clojure/clojure.git Sorry for the noise. Thanks, I've been mistakenly working from git://github.com/richhickey/clojure.git ...which is apparently why

Re: Clojure 1.2 Beta 1

2010-07-16 Thread Jeffrey Schwab
On 7/16/10 2:42 PM, Cyrus Harmon wrote: Going to http:// clojure.org, searching for git and following the "Clojure goes git" link would lead one to http://groups.google.com/group/clojure/msg/ca4fb58428052554 which suggests that the rickhickey page is the right one. Where's the announcement abo

Re: Clojure 1.2 Beta 1

2010-07-17 Thread Jeffrey Schwab
On 7/17/10 5:50 AM, Meikel Brandmeyer wrote: On 7/16/10 2:42 PM, Cyrus Harmon wrote: Going to http:// clojure.org, searching for git and following the "Clojure goes git" link would lead one to http://groups.google.com/group/clojure/msg/ca4fb58428052554 which suggests that the rickhickey pag

Re: Response

2010-07-18 Thread Jeffrey Schwab
On 7/17/10 4:43 PM, Isaac Hodes wrote: Apologies in advance if this is somewhat OT in a Clojure group. double convolve(double *xs, double *is, double *ys){ int i,j; for(i=0; i How are you getting the size of the collections from the pointers, and why are you checking the lengths on ever

Re: fs - file system utilities for Clojure

2011-03-23 Thread Jeffrey Schwab
Not so. Windows commands of the form "someProgram /some/path" often mistake /some/path for command-line switches (like Unix flags). I had real-world problems with this when trying to run a Rails app on Windows, because of the issue discussed here: http://www.ruby-forum.com/topic/50137 -- You

Re: Clojures macro system is essentially hygienic -- In the good sense.

2011-04-12 Thread Jeffrey Schwab
On Tuesday, April 12, 2011 9:25:25 AM UTC-4, rob wrote: > > One Scheme advocate I know has that suggested that it would be more > hygienic to have gensyms be the rule instead of the exception to the rule > (you could still get capture by asking to *not* gensym). I'm not certain I > agree with

Re: Adding key values in a list of maps

2011-04-15 Thread Jeffrey Schwab
On Thursday, April 14, 2011 8:51:47 PM UTC-4, Andreas Kostler wrote: > > (reduce + (map :b p)) ; Or, save one character: (apply + (map :b p)) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.

Re: Shebang support for cljr

2011-04-20 Thread Jeffrey Schwab
On Wednesday, April 20, 2011 1:28:38 PM UTC-4, Mike Meyer wrote: > > On Wed, 20 Apr 2011 10:16:05 -0700 (PDT) > David Jacobs wrote: > > > What's the status on this? One of the reasons I don't use Clojure > everyday, > > much as I like it, is that I want it to integrate seamlessly with Unix >

Re: Shebang support for cljr

2011-04-20 Thread Jeffrey Schwab
How would you correct it in thread-safe manner? AFAIK, the JVM's notion of "current working directory" is a single, global value. There are other subtle issues, as well, e.g., anybody who can connect to your nailgun server can cause arbitrary code to be executed in your name. One of the more

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Jeffrey Schwab
Boo. Keep the paywall. Don't make me look at ads. And for the record, you're not paying for information, but rather to have the information presented in a particular way. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: Any wisdom in the math speed of different clojure libraries?

2011-05-03 Thread Jeffrey Schwab
On Tuesday, May 3, 2011 3:20:25 PM UTC-4, David Nolen wrote: > > On Tue, May 3, 2011 at 2:51 PM, Ken Wesson wrote: > >> It's optimizing your loop away, or else you're using ridiculously >> powerful hardware. >> >> user=> (time (dotimes [_ 100] (Math/ceil (rand >> "Elapsed time: 142.86748

Re: Clojure Atlas now available (an experimental visualization of the Clojure language & standard library)

2011-05-03 Thread Jeffrey Schwab
On Tuesday, May 3, 2011 3:31:33 PM UTC-4, tbc++ wrote: > > > On Tue, May 3, 2011 at 2:28 PM, Jeffrey Schwab wrote: > >> Boo. Keep the paywall. Don't make me look at ads. And for the record, >> you're not paying for information, but rather to have the informa

pretty-print by default?

2011-07-01 Thread Jeffrey Schwab
Is there any way to make the Clojure repl pretty-print by default? I have a bunch of little functions that return things like directory listings and git output, mostly as seqs of lines or Files. I could change the functions to pretty-print (rather than return) their results, but I often want to p

Re: pretty-print by default?

2011-07-01 Thread Jeffrey Schwab
Thank you! That is exactly what I needed. -- 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 posts from new members are moderated - please be patient with your first post. To unsub

Re: pretty-print by default?

2011-07-01 Thread Jeffrey Schwab
I tried adding (clojure.main/repl :print pprint) to my user.clj, but clojure then reports an error, because clojure.main/repl does not (yet) exist. Is there any work-around for this? Maybe a way to register onLoad style hooks that will be executed once the repl is running? Here's my current

Re: pretty-print by default?

2011-07-01 Thread Jeffrey Schwab
Thank! Why -r? The (clojure.main/repl) call seems to start a new repl. (In fact, it took me a minute to figure out that this really needs to be the last thing in repl-init.clj.) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

RuntimeException: Can't embed object in code, maybe print-dup not defined

2011-03-11 Thread Jeffrey Schwab
What does eval'ing a form containing an object reference cause an exception? What am I doing wrong? user=> (eval [(java.util.Date.)]) java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: Fri Mar 11 19:33:04 EST 2011 (NO_SOURCE_FILE:153) This is the simplest exam