Re: Printing to *out* in another thread

2009-10-18 Thread Alex Osborne
mbrodersen wrote: >> Using atoms is not a good idea. Unless you don't mind if the same >> message is sometimes printed more than once. Atoms are implemented >> using spin locks with automatic retry. > > Hmmm...unless add-watch => observer is called only once. Looking in clojure/lang/Atom.java:

Re: Printing to *out* in another thread

2009-10-18 Thread mbrodersen
> Using atoms is not a good idea. Unless you don't mind if the same > message is sometimes printed more than once. Atoms are implemented > using spin locks with automatic retry. Hmmm...unless add-watch => observer is called only once. So I might be wrong :-) Interesting. Anybody knows more abou

Re: Printing to *out* in another thread

2009-10-18 Thread mbrodersen
Using atoms is not a good idea. Unless you don't mind if the same message is sometimes printed more than once. Atoms are implemented using spin locks with automatic retry. Cheers Morten --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Printing to *out* in another thread

2009-10-18 Thread Gorsal
Dang, you're ri ght, I didn't even notice. This is a nice feature, separating everything. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegrou

Re: Printing to *out* in another thread

2009-10-18 Thread John Harrop
On Sun, Oct 18, 2009 at 2:04 AM, Gorsal wrote: > > I just tried this on the eclipse clojure repl, it works. So i guess it > is an enclojure thing! (.println System/out "HI") also doesn't work on > the netbeans repl, but does on the enclojure. I'll ask on the > enclojure mailing group. Thanks for t

Re: Printing to *out* in another thread

2009-10-18 Thread Volkan YAZICI
On Sat, 17 Oct 2009, mbrodersen writes: > If you want to print to stdout from multiple threads without getting > the printing garbeled you can do something like the following (it also > logs all printed values): > > (def wa-debug-agent) > > (defn wa-debug-make [] > (def wa-debug-agent (agen

Re: Printing to *out* in another thread

2009-10-17 Thread Gorsal
I just tried this on the eclipse clojure repl, it works. So i guess it is an enclojure thing! (.println System/out "HI") also doesn't work on the netbeans repl, but does on the enclojure. I'll ask on the enclojure mailing group. Thanks for the help! --~--~-~--~~~---~--~

Re: Printing to *out* in another thread

2009-10-17 Thread Gorsal
I'm not using emacs. I'm using netbeans and the enclojure plugin. What normal clojure repl are u using? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goog

Re: Printing to *out* in another thread

2009-10-17 Thread mbrodersen
Hmmm...it works with the normal Clojure REPL. So it must be an Emacs thingy. --~--~-~--~~~---~--~~ 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 post

Re: Printing to *out* in another thread

2009-10-17 Thread Gorsal
Well, i should say, no print output occurs in the repl, which i assume is where it is supposed to appear? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@go

Re: Printing to *out* in another thread

2009-10-17 Thread Gorsal
Hmm.. This doesn't appear to work. When i go (wa-debug-make) and then (wa-debug-print "HI") it returns # The agent has been logged with the value "HI", but no print output occurs. I'm using the netbeans enclojure plugin, btw. --~--~-~--~~~---~--~~ You received this

Re: Printing to *out* in another thread

2009-10-17 Thread mbrodersen
If you want to print to stdout from multiple threads without getting the printing garbeled you can do something like the following (it also logs all printed values): (def wa-debug-agent) (defn wa-debug-make [] (def wa-debug-agent (agent []))) (defn wa-debug-print "This makes it

Re: Printing to *out* in another thread

2009-10-17 Thread jan
Gorsal writes: > How am i supposed to print to the output from another thread? > I want, for example, > (future (println "HI")) to print hi. It doesn't. If you are using slime the default behaviour will be to print "HI" to the *inferior-lisp* buffer. You can redirect output to the repl with M-x

Printing to *out* in another thread

2009-10-17 Thread Gorsal
How am i supposed to print to the output from another thread? I want, for example, (future (println "HI")) to print hi. It doesn't. Merci! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi