Re: Ant build.xml snippet: compile

2009-07-23 Thread Meikel Brandmeyer
Hi, Am 22.07.2009 um 20:46 schrieb Christopher Wilson: Sorry if this is a bit OT, but has anyone created an ant or maven jar task (maven: is 'goal' the correct term)? In the few jars that I've created I've AOT compiled my .clj files and hand-created the jar file. The way that I do this is

Reading items in doto from a vector (using swing)

2009-07-23 Thread Volker
I have some problems with using swing from clojure. Starting from the working choice list: (defn direct-ui [] (let [ tmp-my-list (doto (new DefaultListModel) (.addElement Item1) (.addElement Item2)

Re: Reading items in doto from a vector (using swing)

2009-07-23 Thread Meikel Brandmeyer
Hi, the macro only works with the vector itself, because otherwise it only sees the symbol, but not the vector. What you want is a doseq loop. (defn add-elements [model elements] (doseq [elem elements] (.addElement model elem))) Then you can do: (doto (DefaultListModel.)

Re: Reading items in doto from a vector (using swing)

2009-07-23 Thread Volker
That solved it, thank you! Volker --~--~-~--~~~---~--~~ 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

Re: Logging functions delegated to java logging systems

2009-07-23 Thread ataggart
Ok, I've updated the code with some of Tim's code: http://paste.lisp.org/display/84053 The public functions/macros are: enabled? [level] [level log-name] true/false whether that level is enabled for the current namespace or log-name log [level message ...] logs the message either directly

Re: Logging functions delegated to java logging systems

2009-07-23 Thread Laurent PETIT
Hello, 2009/7/23 ataggart alex.tagg...@gmail.com Ok, I've updated the code with some of Tim's code: http://paste.lisp.org/display/84053 The public functions/macros are: enabled? [level] [level log-name] true/false whether that level is enabled for the current namespace or log-name

Re: Logging functions delegated to java logging systems

2009-07-23 Thread Timothy Pratley
Hi Laurent, I believe using (log :fine (expensive-calc)) will do precisely what you describe (not do anything unless level :fine is enabled, and return nil) (debug (some-expr)) is intended when you want to leave the logic precisely as is but display part of the calculation; (+ a b (- c d)) ;

Re: easiest JMX API ever, in Clojure...

2009-07-23 Thread David Powell
A remote process (process not running on the same machine as JMX client) can usually be accessed through an RMI connection. I might be totally wrong here, but jconsole lets you connect to any java process on Java 1.6, without needing jmxremote properties. I got the impression, that this is

Re: Approaching Clojure-Hibernate integration using hibernate.default_entity_mode = dynamic-map (Feedback Request)

2009-07-23 Thread pmf
I've also looked into the dynamic-map stuff, but found only rudimentary documentation, which caused me to give up. It's nice to see that you seem to have gotten further. For me personally, well-polished defmodel/hbm-property functionality would be much more important than a query-DSL (since you

Re: Multimethods dispatching - performance for larger taxonomies

2009-07-23 Thread Garth Sheldon-Coulson
Hi Stuart, Could you give me a two-sentence description, or a pointer to a description, of what keyword inheritance is? Apparently this is something I haven't encountered or don't remember... Thanks a lot. On Wed, Jul 22, 2009 at 10:48 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: I

Re: classloading / proxy / JMX issue

2009-07-23 Thread Stuart Halloway
I am learning JMX as a I go here (by writing tests) and was hoping that registerMBean doesn't depend on the actual class (or its name). What's the point of interfaces if you write APIs that require classes? I am still hoping to make this work with a proxy, but I will try out a

Re: Multimethods dispatching - performance for larger taxonomies

2009-07-23 Thread Stuart Halloway
Clojure's derive function creates an inheritance relationship between keywords (or symbols). I have taken to calling this keyword inheritance to emphasize that the inheritance is at the level of *names*, not of interfaces or methods. The book covers this in the section Adding Inheritance

Re: Approaching Clojure-Hibernate integration using hibernate.default_entity_mode = dynamic-map (Feedback Request)

2009-07-23 Thread Shantanu Kumar
I have an update since my last post. It is technically possible to completely bypass the HBM-XML files and do the mapping stuff programmatically, a route that I will likely take (XML generation does not fit well in the arrangement and should be avoided). Taking this route will bring the

Re: Multimethods dispatching - performance for larger taxonomies

2009-07-23 Thread Garth Sheldon-Coulson
Ah. Thanks. On Thu, Jul 23, 2009 at 8:45 AM, Stuart Halloway stuart.hallo...@gmail.comwrote: Clojure's derive function creates an inheritance relationship between keywords (or symbols). I have taken to calling this keyword inheritance to emphasize that the inheritance is at the level of

Re: Sweeping Networks with Clojure

2009-07-23 Thread Cosmin Stejerean
On Wed, Jul 22, 2009 at 9:56 PM, tmountain tinymount...@gmail.com wrote: I've written a short blog post on using Clojure to search for available ssh servers on my companies VPN. It starts with a single- threaded example and then adds concurrency. The performance difference in this case was

java interoperability : calling set! on several fields of the same instance

2009-07-23 Thread Laurent PETIT
Hello, I want to call set! several times on a same instance, e.g. : (let [instance (SomeBeanCtor.)] (set! (. instance field1) expr1) (set! (. instance field2) expr2) ...) Do you know if a macro simplifying this already exists ? Anyway, I've created one as an exercise, and here it is:

Re: java interoperability : calling set! on several fields of the same instance

2009-07-23 Thread Meikel Brandmeyer
Hi, Am 23.07.2009 um 18:24 schrieb Laurent PETIT: Hello, I want to call set! several times on a same instance, e.g. : (let [instance (SomeBeanCtor.)] (set! (. instance field1) expr1) (set! (. instance field2) expr2) ...) Do you know if a macro simplifying this already exists ? How

Re: Can (genclass) be changed to operate when not compiling?

2009-07-23 Thread Laurent PETIT
I see in clojure.core that you have gen-and-load-class . This may be what you are after ? HTH, -- Laurent 2009/7/22 Howard Lewis Ship hls...@gmail.com I'm using (:gen-class) to create javax.servlet.Filter, then creating a Jetty instance around the filter. Alas, for this to work, I have

Re: java interoperability : calling set! on several fields of the same instance

2009-07-23 Thread Laurent PETIT
Yes it works ! : 1:172 user= (doto (java.awt.Point.) (- .x (set! 2))) #Point java.awt.Point[x=2,y=0] I hadn't thought about this possible combination, thanks Meikel. So now, is mset! worth the trouble ? Let's compare them again: (doto (SomeBeanCtor.) (- .field1 (set! expr1)) (- .field2

Re: Logging functions delegated to java logging systems

2009-07-23 Thread ataggart
Tim is correct. The log macro is what you want to use when you're really just wanting to log something; in that case the message expression won't get evaluated unless the particular logging level is enabled. The debug function is for when you want to execute an expression regardless, but would

Re: Logging functions delegated to java logging systems

2009-07-23 Thread ataggart
Hmm, I like spy since it doesn't mimic a logging level like debug and trace do. Making the change now, thanks. On Jul 23, 11:01 am, Laurent PETIT laurent.pe...@gmail.com wrote: What about 'spy instead of 'debug ? Or 'trace ? 2009/7/23 ataggart alex.tagg...@gmail.com Tim is correct.  

Re: Sweeping Networks with Clojure

2009-07-23 Thread Jeremy Gailor
Hey Travis, I just went through your article, worked through your code, tinkered. Great job. I'm learning Clojure now and these are definitely the types of articles that make it a lot easier to see how to work with all of the concurrency mechanisms that the language provides. - Jeremy On Wed,

Risks of (over-)using destructuring?

2009-07-23 Thread pcda...@gmail.com
Hi. I'm learning Clojure, and I like a lot what I've seen so far. Thank you Rich for designing such a nice langage, and Stuart for writing such a great book! I'm a little worried about the pattern matching/destructuring binding feature though. It looks very powerful, but also very dangerous. It

Re: Risks of (over-)using destructuring?

2009-07-23 Thread Richard Newman
Coming from an OO background which puts a strong focus on data encapsulation, this makes me a little nervous. The same problem exists with OO. For example, maybe you return a Headers object from a request. A couple of releases down the line you realize you need to include some

Re: Clojure as a CGI language?

2009-07-23 Thread cody koeninger
On Jul 22, 10:15 am, Chouser chou...@gmail.com wrote: Java and therefore Clojure does not play nicely in this niche as far as I can tell.  Even if a service allows ssh access such that you can install a JVM, Clojure, etc. it's almost certain you will not be allowed to keep a long-running

Re: Risks of (over-)using destructuring?

2009-07-23 Thread Laurent PETIT
Hi, I think it is fair to consider that everything the client of your (public) function can find in the printed value from a call to (doc some-public-fun) is part of the contract of the fun. And the arglist(s) are printed as part of the call to 'doc. But sometimes, one may want to leverage the