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 v

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: I need help tracking down a performance problem.

2009-03-19 Thread stephaner
Hi Mr Foley, Running your code on my machine give the following result: (load-file "slow.clj") "Elapsed time: 1736.034068 msecs" nil user> (load-file "slow.clj") "Elapsed time: 678.850779 msecs" nil I'm on Ubuntu 8.10 on a Hp dv6700 with 2gig RAM. Stephane On Mar 19, 8:12 pm, Vincent Foley wr

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread e
> > A more fundamental question than how best to do it is - who needs > this? Does someone have a real need for parallel let? > > Rich > > is "parallel let" just a conventional description? What I mean is that it seems like I could provide an argument c) to that list, namely, that, some day, the a

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

2009-03-19 Thread e
On Thu, Mar 19, 2009 at 3:13 PM, Rich Hickey wrote: > If someone's going to do an object system for Clojure, it > should be one in which the entire state of an object is available as a > value. I can see that. it's sort of like the command vs. query dichotomy expressed for, say, Eiffel needs

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 though

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

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] []

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 wrote: > > However the code (proxy-superpublish m) throws this exce

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 clojure.la

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 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://c

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: 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 o

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

2009-03-19 Thread mikel
On Mar 19, 2:13 pm, Rich Hickey wrote: > On Mar 19, 2009, at 2:14 PM, mikel wrote: > > > > > On Mar 19, 7:17 am, David Nolen 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 > >

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 > 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 --~--~-~--~~~---~--~~ You rece

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 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 Computing, Inc. --~--~

Re: Enlive questions

2009-03-19 Thread Phil Hagelberg
Christophe Grand 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 initially, you don't care abo

Re: Problem with SwingWorker and proxy-super

2009-03-19 Thread MikeM
> However the code (proxy-super publish m) throws this exception: > > # 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) lets you access it. Also, even if it was public, it is a var-

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 suggest

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 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 carri

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 JTextField

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

2009-03-19 Thread mikel
On Mar 19, 7:17 am, David Nolen 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 closed-over lexical environm

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 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 lacking? Ho

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 G

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

Re: Enlive questions

2009-03-19 Thread Phil Hagelberg
Christophe Grand 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 redesign. Yeah, I'm

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread Stuart Sierra
On Mar 19, 8:22 am, Rich Hickey 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 this message because

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: 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 d

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Frantisek Sodomka
On Mar 19, 12:58 pm, Jason Sankey 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 clojure.core are

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 a

Re: Slash mystery

2009-03-19 Thread Michael Wood
On Wed, Mar 18, 2009 at 10:31 PM, Kevin Downey 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 Wood wrote

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Rich Hickey
On Mar 19, 7:22 am, Christophe Grand 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 talking

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 ca

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread Rich Hickey
On Mar 19, 2009, at 7:53 AM, e wrote: > > > Can't you already do this with: > (let [[a b c] [1 a 3]] > (prn a b c)) > > > if, indeed you can, that seems to violate the very interesting, > recent discussion Rich initiated that someone recoined as the > Property Design Pattern. So, on one ha

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 few

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 wrote: > > 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/

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Jason Sankey
Hi Christophe, On Mar 19, 11:22 am, Christophe Grand 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 w

Re: Request Feedback on Clojure Blog Article

2009-03-19 Thread e
> > Can't you already do this with: > (let [[a b c] [1 a 3]] > (prn a b c)) > > if, indeed you can, that seems to violate the very interesting, recent discussion Rich initiated that someone recoined as the Property Design Pattern. So, on one hand, having let process args lazily is consistent with

Re: Possible Bug In clojure.zip/remove

2009-03-19 Thread Christophe Grand
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 talking about :). > No you are right and there's the same bug in

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 conclu

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. --~--~-~--~~~---~--~--

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 --~--~--

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

Can Clojure simulate Class?Lisp can!

2009-03-19 Thread Edward Shen
Hello,guys! I'm reading 《Programming Clojure》. I've seen closure. But I haven't seen how simulate Class. Lisp can simulate Class by closure and nest Function. Example: (define (make-account balance) (define (withdraw amount) (if (>= balance amount) (begin (set! balance (- balance a

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 qu

Caching reflected methods (Re: Game of Life)

2009-03-19 Thread Remco van 't Veer
I've noticed a related performance bottleneck when working with clojure on dalvik. Without type hints methods get looked up using reflection every time using clojure.lang.Reflector.getMethods. A lot if time is spend in this method while the results can easily be cached. This is probably only rel

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 >

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 sam

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