Re: User defined extensions with Xpath

2011-03-02 Thread Perry Trolard
Hi Andrei, I'm the author of the saxon wrapper library at https://github.com/pjt/saxon. User-defined XPath functions are indeed desirable but I haven't done anything special in the library to help in implementing them. What's available by default in Saxon is the ability to call Java methods. For

Swank fix for slime cvs

2011-03-02 Thread sky
Hi, I'm new and just started coding in clojure. Today I tried the latest slime with swank-clojure. A slime cvs > 2010-09 have problems interfacing with swank-clojure (even then 1.3.0) because of a change in the :abort message. I kind of hack-fixed them, and figured that some of you may find the fi

trunk

2011-03-02 Thread Feng
Hello Rich, Lazy defn loading commit to 1.3.0-master introduced a bug or breakage. Clojure 1.3.0-master-SNAPSHOT user=> (require 'swank.swank) user=> (swank.commands.basic/connection-info) ClassNotFoundException swank/commands/basic $eval695$connection_info__696 java.lang.Class.forName0 (Class.ja

Re: A blocking function

2011-03-02 Thread Aaron Cohen
On Wed, Mar 2, 2011 at 6:49 PM, Daniel Solano Gomez wrote: > On Wed Mar 2 15:44 2011, clj123123 wrote: > > In a multi thread app, is there a way to mark a function to be > > blocking so it can run not simultaneously but would be blocking for > > each thread? > > You could try the locking macro.

Re: A blocking function

2011-03-02 Thread Stuart Sierra
Yes, `locking` on the function itself will work; it's roughly equivalent to a `synchronized` method in Java. Also try Agents, as Ken suggests. -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send em

Re: A blocking function

2011-03-02 Thread Ken Wesson
On Wed, Mar 2, 2011 at 6:49 PM, Daniel Solano Gomez wrote: > On Wed Mar  2 15:44 2011, clj123123 wrote: >> In a multi thread app, is there a way to mark a function to be >> blocking so it can run not simultaneously but would be blocking for >> each thread? > > You could try the locking macro.  For

Re: A blocking function

2011-03-02 Thread Daniel Solano Gomez
On Wed Mar 2 15:44 2011, clj123123 wrote: > In a multi thread app, is there a way to mark a function to be > blocking so it can run not simultaneously but would be blocking for > each thread? You could try the locking macro. For this you need an object to lock on. I suppose you could lock on th

A blocking function

2011-03-02 Thread clj123123
In a multi thread app, is there a way to mark a function to be blocking so it can run not simultaneously but would be blocking for each thread? Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

Re: Master worker pattern

2011-03-02 Thread Jonathan Mitchem
At the risk of sounding incredibly uneducated about the matter (oh wait, it's true): What is the purpose/need/reason for this kind of architecture? What can you do with it? Where would you use it? Why would you use it? Thanks, Jonathan -- You received this message because you are subscrib

Re: Printing to *out* from macro

2011-03-02 Thread Vitaly Peressada
Ken and Alan, Thanks for your clarification; point noted. On Mar 2, 1:14 pm, Alan wrote: > On Mar 2, 8:36 am, Ken Wesson wrote: > > > > > > > > > > > On Wed, Mar 2, 2011 at 9:52 AM, Vitaly Peressada > > wrote: > > > Ken, > > > >> Well for one thing it's printing stuff at macroexpansion time.

Safe SWT sync-exec with clojure 'dataflow' variables

2011-03-02 Thread Laurent PETIT
It occured to me the other day that it's dead easy to write a safe "sync-exec" clojure version of SWT's Display/syncExec method. The idea is to really execute a Display/asyncExec call, but make the calling thread wait for the asyncExec return value via clojure dataflow feature, aka promise/deliver

Re: Printing to *out* from macro

2011-03-02 Thread Alan
On Mar 2, 8:36 am, Ken Wesson wrote: > On Wed, Mar 2, 2011 at 9:52 AM, Vitaly Peressada wrote: > > Ken, > > >> Well for one thing it's printing stuff at macroexpansion time. > > > I don't think this the issue. I have tried this in Clojure's REPL and > > it worked fine > > It would work at the REP

Re: CLR classpath

2011-03-02 Thread dmiller
(1) I think the copy solution is the easiest. ClojureCLR deals with its dependencies on the DLR dlls exactly as you describe, with custom build step to copy DLLs from a lib directory. You will need a project reference at least to Clojure.dll. You will need the files in clojure/ subdirectory co

Re: Printing to *out* from macro

2011-03-02 Thread Ken Wesson
On Wed, Mar 2, 2011 at 9:52 AM, Vitaly Peressada wrote: > Ken, > >> Well for one thing it's printing stuff at macroexpansion time. > > I don't think this the issue. I have tried this in Clojure's REPL and > it worked fine It would work at the REPL wrapping a single expression because macroexpansi

Re: Printing to *out* from macro

2011-03-02 Thread Meikel Brandmeyer
Hi, Ok. I understand the problem now. Things work as expected. You get the output in one go, because Vim waits for the command to complete. There is no polling going on. This is an intrinsic limitation of Vim. You either have to use something different like slimv. Or start a Repl in an external c

Re: Printing to *out* from macro

2011-03-02 Thread Meikel Brandmeyer
Hi, On 2 Mrz., 15:52, Vitaly Peressada wrote: > I don't think this the issue. I have tried this in Clojure's REPL and > it worked fine > > (defmacro run-with-msg [msg & body] >   (do >      (.write *out* (format "%s..." msg)) >      (.flush *out*)) >      `(let [res# ~@body] >        (println "d

Re: Printing to *out* from macro

2011-03-02 Thread Vitaly Peressada
Ken, > Well for one thing it's printing stuff at macroexpansion time. I don't think this the issue. I have tried this in Clojure's REPL and it worked fine (defmacro run-with-msg [msg & body] (do (.write *out* (format "%s..." msg)) (.flush *out*)) `(let [res# ~@body] (prin

Re: Printing to *out* from macro

2011-03-02 Thread .Bill Smith
I guess I should say I'm using Emacs clojure-mode without Slime or swank. -- 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

Re: Printing to *out* from macro

2011-03-02 Thread Ken Wesson
On Wed, Mar 2, 2011 at 8:54 AM, Vitaly Peressada wrote: > I want to have a way to print progress message before and after > invoking a function/expression. Came up with this macro > > (defmacro run-with-msg [msg & body] >  (doto *out* >  (. write (format "%s..." msg)) >  (. flush)) >  `(let [res#

Re: Printing to *out* from macro

2011-03-02 Thread .Bill Smith
It may have to do with whether the environment you are using buffers Clojure's output. When I run your example code in Emacs, I see this: user=> (run-with-msg "Working" (Thread/sleep 2000)) Working... and then 2 seconds later, it looks like this: user=> (run-with-msg "Working" (Thread/sleep 2

Re: better error messages > smaller stack traces

2011-03-02 Thread Mark
Thanks! On Mar 2, 5:19 am, Ken Wesson wrote: > On Wed, Mar 2, 2011 at 3:32 AM, Alan wrote: > > '(apply + 1 1) would be how you create a list of those symbols. > > Or (list 'apply '+ 1 1) or `(apply + 1 1), both of which allow you to > put something variable in there, like (list 'apply '+ 1 x) or

Printing to *out* from macro

2011-03-02 Thread Vitaly Peressada
I want to have a way to print progress message before and after invoking a function/expression. Came up with this macro (defmacro run-with-msg [msg & body] (doto *out* (. write (format "%s..." msg)) (. flush)) `(let [res# ~@body] (println "done") res#)) user=> (run-with-msg "Worki

Re: Serialising functions...

2011-03-02 Thread Jules
Thanks, Guys, for all your help. Here is an update on where I have got to : I've given up no trying to aspect the DynamicClassLoader for a while (maybe forever) as spring/aspecjt/load-time-weaving does not seem to work at the repl - I've posted another thread regarding this - no answers as yet.

Re: unchecked-divide etc being replaced in 1.3 - no more support for longs?

2011-03-02 Thread ataggart
If I understand their original purpose, the various int-named math ops will be obivated once the patch to CLJ-445 is applied. http://dev.clojure.org/jira/browse/CLJ-445 On Feb 27, 9:04 am, Joost wrote: > Hi, > > I just noticed that in 1.3 alpha 4, unchecked-divide (which seemed to > support lon

Re: better error messages > smaller stack traces

2011-03-02 Thread Ken Wesson
On Wed, Mar 2, 2011 at 3:32 AM, Alan wrote: > '(apply + 1 1) would be how you create a list of those symbols. Or (list 'apply '+ 1 1) or `(apply + 1 1), both of which allow you to put something variable in there, like (list 'apply '+ 1 x) or `(apply + 1 ~x). -- You received this message because

Re: Eclipse clojure & maven

2011-03-02 Thread Laurent PETIT
Hi, It's not clear to me, from the subject of your email nor its content, whether this is a pure "clojure-maven-plugin" issue, or also related to Eclipse, and/or related to Counterclockwise. Cheers, -- Laurent 2011/3/2 Zlatko Josic > Hi, > > I use eclipse clojure & maven for developing appli

Eclipse clojure & maven

2011-03-02 Thread Zlatko Josic
Hi, I use eclipse clojure & maven for developing applications. I have clojure maven plugin installed. I start script with clojure:run goal. The script creates server socket. After i terminate script from eclipse the socket is stil alive. When I start script again I got address already in use error

Re: unchecked-divide etc being replaced in 1.3 - no more support for longs?

2011-03-02 Thread Albert Cardona
2011/3/2 Meikel Brandmeyer : > Hi, > > On 2 Mrz., 10:44, Albert Cardona wrote: > >> I get: >> >> user=> (set! *unchecked-math* true) >> java.lang.IllegalStateException: Can't change/establish root binding >> of: *unchecked-math* with set >> >> ... with latest clojure from git master branch. > > Ho

Re: unchecked-divide etc being replaced in 1.3 - no more support for longs?

2011-03-02 Thread Meikel Brandmeyer
Hi, On 2 Mrz., 10:44, Albert Cardona wrote: > I get: > > user=> (set! *unchecked-math* true) > java.lang.IllegalStateException: Can't change/establish root binding > of: *unchecked-math* with set > > ... with latest clojure from git master branch. How did you start your Repl? In case it's not C

Re: unchecked-divide etc being replaced in 1.3 - no more support for longs?

2011-03-02 Thread Albert Cardona
Jason, 2011/3/1 Jason Wolfe : >> But I don't know what the plan is if you really do want truncating >> arithmetic on longs. > > On 1.3 alpha 4: > > user=> (+ Long/MAX_VALUE Long/MAX_VALUE) > ArithmeticException integer overflow > clojure.lang.Numbers.throwIntOverflow (Numbers.java:1581) > > user=>

Re: better error messages > smaller stack traces

2011-03-02 Thread Alan
'(apply + 1 1) would be how you create a list of those symbols. ('apply + 1 1) says "call the function 'apply with the arguments of + 1 and 1". On Mar 1, 8:37 pm, Mark wrote: > I found the problem: > ('apply + 1 1) > > I understand why this won't work if I tried to eval the list, but I > don't un