Re: Enlive questions

2009-03-19 Thread Christophe Grand
Hi Phil! Phil Hagelberg a écrit : I'm using the Enlive library, and so far I've been pretty impressed. The way it separates templates out into their own files and doesn't allow any logic to get mixed up with them is great. Thanks for the kind words. One thing I noticed is that its

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread Joshua Fox
Great article! Although I’ve done only a little Ruby metaprogramming, my sense is that Clojure’s macros make it more powerful than Ruby in this respect It would be good to see a comparison of metaprogramming with macros. They sometimes are used for similar purposes, but of course are not the same

Re: Enlive questions

2009-03-19 Thread Christophe Grand
Phil Hagelberg a écrit : From what I can tell the difference seems to be that it goes inside the node if it's a string, and it replaces the node if it's a function call, even if the function call results in a string. This behaviour seems really strange. I feel like maybe there's some logic

Re: Slash mystery

2009-03-19 Thread Konrad Hinsen
On 18.03.2009, at 19:03, Konrad Hinsen wrote: Why is user// an invalid token, whereas clojure.core// works perfectly well? I found out in the meantime that clojure.core// is indeed handled as a special case by the reader (line 276 in LispReader.java), but that still doesn't answer the

Can Clojure simulate Class?Lisp can do it!

2009-03-19 Thread Edward Shen
Can Clojure simulate Class?Lisp can do it! Anyone know it? --~--~-~--~~~---~--~~ 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 To unsubscribe from this

Re: Which Java book(s) to order

2009-03-19 Thread Todd Fincannon
For the Java libraries, I like Java Cookbook 2ed by Ian Darwin. It doesn't spend much time on the language. It includes introductions to Swing, network clients and servers, regular expressions, introspection, and JDBC. It was published in 2004, so it doesn't cover Java 6. Todd Fincannon

Re: Can Clojure simulate Class?Lisp can do it!

2009-03-19 Thread Konrad Hinsen
On 19.03.2009, at 07:54, Edward Shen wrote: Can Clojure simulate Class?Lisp can do it! Anyone know it? Clojure can do it as well. Look here for a library that does it: http://github.com/swannodette/spinoza/tree/master Konrad.

Possible Bug In clojure.zip/remove

2009-03-19 Thread Jason Sankey
Hi All, I've been teaching myself clojure and in the process am working on a small program to manipulate an XML file. I figured this was a good chance to try clojure.zip, but I'm having some difficulty. Being a newbie I strongly suspected myself - but when I posed the question on IRC the

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Jason Sankey
Hi Christophe, On Mar 19, 11:22 am, Christophe Grand christo...@cgrand.net wrote: Jason Sankey a écrit : (if (and (branch? loc) (not (empty? (children loc   (recur (- loc down rightmost))   loc)) Being new to both clojure and zip I admit there's still a good chance that I have

Re: Can Clojure simulate Class?Lisp can do it!

2009-03-19 Thread e
On Thu, Mar 19, 2009 at 6:34 AM, Konrad Hinsen konrad.hin...@laposte.netwrote: On 19.03.2009, at 07:54, Edward Shen wrote: Can Clojure simulate Class?Lisp can do it! Anyone know it? Clojure can do it as well. Look here for a library that does it:

Re: Can Clojure simulate Class?Lisp can do it!

2009-03-19 Thread David Nolen
Doesn't On Lisp talk about simulating CLOS with closures? It's free online. I would like to add as the creator that I would not use Spinoza yet ;) And I've put it on hold as I'm currently obsessed with trying to port cl-cont. Spinoza still needs quite a bit of work, I started on that before a

Complex numbers in clojure.contrib

2009-03-19 Thread Konrad Hinsen
I just checked in clojure.contrib.complex-numbers, a complex number library. For the moment it implements only comparison and arithmetic, but I intend to add maths functions later. Complex numbers are represented by struct maps with two keys, :real and :imag. The real and imaginary parts

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Rich Hickey
On Mar 19, 7:22 am, Christophe Grand christo...@cgrand.net wrote: Jason Sankey a écrit : (if (and (branch? loc) (not (empty? (children loc (recur (- loc down rightmost)) loc)) Being new to both clojure and zip I admit there's still a good chance that I have no idea what I'm

Re: Slash mystery

2009-03-19 Thread Michael Wood
On Wed, Mar 18, 2009 at 10:31 PM, Kevin Downey redc...@gmail.com wrote: Symbols starting and ending with . are reserved. see http://clojure.org/reader the section on Symbols Fair enough, but why does the (defn) succeed if these symbols are reserved? On Wed, Mar 18, 2009 at 12:58 PM, Michael

Emacs: function for automatic symbols declaration

2009-03-19 Thread Elena
Hi, I managed to put together an Emacs Lisp function to automatically declare all defined symbols in a Clojure source file. The algorithm is crude: it doesn't understand syntax, it just parses lines beginning with either (def or (defn . A single line beginning with (declare macro must

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Frantisek Sodomka
On Mar 19, 12:58 pm, Jason Sankey ja...@zutubi.com wrote: Also, is there somewhere I can contribute test cases for this to prevent a future regression? In order to contribute, you must fill-in and send The Contributor Agreement (CA) to Rich Hickey: http://clojure.org/contributing Tests for

Re: Slash mystery

2009-03-19 Thread Stephen C. Gilardi
On Mar 19, 2009, at 11:33 AM, Michael Wood wrote: Fair enough, but why does the (defn) succeed if these symbols are reserved? Clojure does not always enforce all the rules. It may come to pass that Clojure will never enforce all the rules as the performance cost and complexity added by

Re: Slash mystery

2009-03-19 Thread Luc Prefontaine
Why not have two behaviours from the same code base ? There could be a strict mode versus an optimized mode. That could allow more optimizations at run time while having a clear trace in the code of these optimizations. The strict mode would be slower but that should be fine when testing. Going

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread Stuart Sierra
On Mar 19, 8:22 am, Rich Hickey richhic...@gmail.com wrote: So far it seems like sequential let has proven a useful default, and   I'd rather have one let than two. Agreed - sequential let is a better default. -Stuart Sierra --~--~-~--~~~---~--~~ You received

Re: Enlive questions

2009-03-19 Thread Phil Hagelberg
Christophe Grand christo...@cgrand.net writes: I'm not quite happy with this behavior: I wanted to preserve the brevity of setting content from a parameter without resorting to (text my-parameter) but it makes things too irregular. This feature will certainly go away as I'm planning a

Re: Enlive questions

2009-03-19 Thread Christophe Grand
Phil Hagelberg a écrit : I notice you use with-test to mix your tests in together with your implementation. This seems to be less common than storing the tests in their own file; I'm wondering if you are happy with this approach? One advantage of keeping things in their own file is that it's

Re: Emacs: function for automatic symbols declaration

2009-03-19 Thread Elena
The code is entirely misaligned. Reposted it as in the files section: http://groups.google.com/group/clojure/web/clj-auto-declare.el Tabs are too wide, I use four spaces wide tabs. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Improving the test suite

2009-03-19 Thread Frantisek Sodomka
Test-clojure is updated and ready for new tests :-) Frantisek On Mar 17, 5:03 am, Phil Hagelberg p...@hagelb.org wrote: OK, so I've posted a fair amount of smack talk about test suites and how important they are--I figure it's time to help out. What are some ways in which test-clojure is

Re: Can Clojure simulate Class?Lisp can do it!

2009-03-19 Thread mikel
On Mar 19, 7:17 am, David Nolen dnolen.li...@gmail.com wrote: Doesn't On Lisp talk about simulating CLOS with closures? It's free online. Building either class-based or prototype-based object systems on closures is pretty straightforward. A closure carries abritrary state around in the

Problem with SwingWorker and proxy-super

2009-03-19 Thread timc
I am trying to understand how to use SwingWorker to do time-consuming work that needs to update a Swing GUI. The following makes a frame with a button (which starts a SwingWorker on the first click). Thereafter, clicking the button increments an integer n that is displayed in the first

Re: Can Clojure simulate Class?Lisp can do it!

2009-03-19 Thread Rich Hickey
On Mar 19, 2009, at 2:14 PM, mikel wrote: On Mar 19, 7:17 am, David Nolen dnolen.li...@gmail.com wrote: Doesn't On Lisp talk about simulating CLOS with closures? It's free online. Building either class-based or prototype-based object systems on closures is pretty straightforward. A

test-is: new feature suggestion

2009-03-19 Thread Frantisek Sodomka
Hello Stuart all! As discussed in this thread: test-is: generating and processing testing data http://groups.google.com/group/clojure/browse_frm/thread/3e84efefd7c0bebc/3652a4a9a124cc6b , sometimes it is necessary to test each value against each value. Example is zeros-are-equal (as you

Re: Problem with SwingWorker and proxy-super

2009-03-19 Thread MikeM
However the code (proxy-super publish m) throws this exception: #IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: publish for class clojure.proxy.javax.swing.SwingWorker publish is a protected method, and I don't think proxy (even with proxy-super)

Re: Enlive questions

2009-03-19 Thread Phil Hagelberg
Christophe Grand christo...@cgrand.net writes: I see two advantages to using with-test: * documentation/usage examples as you pointed out, Actually I meant that it's nicer for documentation to have the tests in a separate file since when you're trying to learn how to use the library

Re: Can Clojure simulate Class?Lisp can do it!

2009-03-19 Thread Mark Volkmann
On Thu, Mar 19, 2009 at 2:13 PM, Rich Hickey richhic...@gmail.com wrote: http://clojure.org/state This is a great essay that I hadn't read before! I think it was written before Atoms were added to Clojure or they would be mentioned along with Refs and Agents. -- R. Mark Volkmann Object

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread Joshua Fox
On Wed, Mar 18, 2009 at 10:40 PM, Stephen C. Gilardi squee...@mac.com wrote: Because parallel bindings are also useful Could you explain? I don't understand the justification for let in Lisp, when let* seems so much more useful. Joshua

Re: Can Clojure simulate Class?Lisp can do it!

2009-03-19 Thread mikel
On Mar 19, 2:13 pm, Rich Hickey richhic...@gmail.com wrote: On Mar 19, 2009, at 2:14 PM, mikel wrote: On Mar 19, 7:17 am, David Nolen dnolen.li...@gmail.com wrote: Doesn't On Lisp talk about simulating CLOS with closures? It's free   online. Building either class-based or

Re: test-is: new feature suggestion

2009-03-19 Thread Stuart Sierra
Hi Frantisek! I can see where this is useful, and the only reason I haven't implemented something like it for a test-is already is that I don't expect it would be very commonly used outside of the very specific case of testing the language itself. Where else, other than a language specification

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread Stephen C. Gilardi
On Mar 19, 2009, at 4:42 PM, Joshua Fox wrote: Because parallel bindings are also useful Could you explain? I don't understand the justification for let in Lisp, when let* seems so much more useful. As I mentioned, I like how Clojure's let works. I'm also fully on board with Rich's

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Jason Sankey
Hi Frantisek, Frantisek Sodomka wrote: On Mar 19, 12:58 pm, Jason Sankey ja...@zutubi.com wrote: Also, is there somewhere I can contribute test cases for this to prevent a future regression? In order to contribute, you must fill-in and send The Contributor Agreement (CA) to Rich Hickey:

clojure.inspector/inspect-tree doesn't work on sets; patch attached

2009-03-19 Thread Jason Wolfe
I was debugging with inspect-tree and noticed that it errors when it encounters a set (it thinks it's not atomic, but then nth produces an UnsupportedOperationException). I made a small patch (below) that makes inspect-tree work on java.util.Sets, and also anything else that implements

Re: Problem with SwingWorker and proxy-super

2009-03-19 Thread timc
It would be a great pity if there was no way to do this, as SwingWorker is the 'proper' way for long-running code to interact with Swing objects. Any ideas for how to achieve this would be appreciated. On Mar 19, 7:35 pm, MikeM michael.messini...@invista.com wrote: However the code

Re: Problem with SwingWorker and proxy-super

2009-03-19 Thread Timothy Pratley
http://clojure.org/java_interop Note that while method fns can be provided to override protected methods, they have no other access to protected members, nor to super, as these capabilities cannot be proxied. However this solution might be adequate: (proxy [SwingWorker] []

I need help tracking down a performance problem.

2009-03-19 Thread Vincent Foley
Hello, For the past few days, I've been trying, unsuccessfully, to make an application I wrote faster. A Java program that performs, more or less, the same task takes 12 seconds (on my machine) to parse 1000 files; my Clojure program takes nearly 3 minutes. This more than an order of magnitude

ANN: Delimited Continuations for Clojure

2009-03-19 Thread David Nolen
You can get it here: http://github.com/swannodette/clj-cont/tree/master So over the past week I've been porting cl-cont ( http://common-lisp.net/project/cl-cont/) originally written by Slava Akhmechet to Clojure. I've now ported most of the functionality that's translatable from Common Lisp

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread Keith Bennett
Tim - If you're running Windows or Linux/Unix (anything other than Mac OS X), then I think the ctrl-x key binding for the shortcut will be overridden by the text field's ctrl-x key binding, which is to the 'cut to clipboard' action. Try selecting some text and pressing ctrl- x to see. Keyboard

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread Keith Bennett
I like the sequential let too. For one thing, it allows for the breaking apart of complex expressions into more comprehensible parts, with well named intermediate variables resulting in self documenting code. For another, if a calculated value is used more than once, then using an intermediate