Useful memory profiling tool

2009-02-13 Thread levand
Determining exactly how much memory objects are using is often desirable, especially since one of Clojure's few flaws (which is the JVM's fault, mostly) is that it can be fairly memory-hungry. So, I took the techniques described in http://www.javaworld.com/javaworld/javatips/jw-javatip130.html,

Re: compiling a GUI app and also: interference of Java's built-in architechture

2009-02-16 Thread levand
> I know that all Java GUI libraries can be used within the REPL, but it is my > understanding that in order to make it self-contained and executable (a jar > or a class file), it is necessary to write some Java and call the Clojure > code from the java applet or application.  Is this true, or am

Re: compiling a GUI app and also: interference of Java's built-in architechture

2009-02-16 Thread levand
I agree, Jambi is a better all-round product... but why the Swing hate? It's fine for what it is. Most of it's drawbacks (horrible L&F, poor performance) are things of the past, now. It would definitely be my framework of choice for a quick, one-off app or an applet. -Luke On Feb 16, 10:50 am,

Error Handling paradigms in Clojure

2009-02-19 Thread levand
So, my project is reaching a sufficient level of complexity where I really need good error tracking - when something goes wrong, I need to know exactly what it was. I have programmed in Java for a long time, and my first instinct is to simply use the try and throw special forms more or less as I

Extensive use of let?

2009-02-25 Thread levand
Recently, in my code, I have been struggling with which of the two equivalent forms is, in a general sense, "better". (defn my-fn1 [input] (let [value1 (op1 input) value2 (op2 input) value3 (op4 value1 value2)] (op5 value3))) (defn my-fn2 [input] (op5 (op4 (op1 input) (op

Workflow poll?

2009-03-06 Thread levand
As my Clojure application is now getting quite complex, I was curious as to what "workflow" people are using for design, development, testing and debugging. I'll get started with what I've found, so far, though I am definitely open to suggestion. There are a few parts I'm not quite satisfied with

Performance conundrum - my primes function should really be faster.

2009-03-12 Thread levand
So, I'm doing the whole Euler thing, and I'm writing a function for finding primes using wheel factorization in combination with the Sieve of Eratosthenes. The algorithm is correct, but very slow. I've managed to isolate the part that's having unexpectedly bad performance. I just can't see why t

"08" and "09" are invalid numbers, but "01" through "07" are fine?

2009-03-12 Thread levand
Seems like there's a bug here. All the digits less than 8 work. If leading zeros aren't allowed, at least the behavior ought to be consistent. (def n 01) #'user/n ... (def n 07) #'user/n BUT (def n 08) clojure.lang.LispReader$ReaderException: java.lang.NumberFormatException: Invalid number: 0

I feel I'm making an elementary mistake with proxy, but I don't know what...

2009-04-01 Thread levand
Isn't this supposed to work? (defn create-layout [] (proxy [java.awt.LayoutManager] [] (addLayoutComponent [name comp] (println "Called addLayoutComponent")) (removeLayoutComponent [comp] (println "Called removeLayoutComponent

Google includes Clojure in App Engine demo

2009-04-13 Thread levand
http://googleappengine.blogspot.com/2009/04/many-languages-and-in-runtime-bind-them.html As a demo of JVM languages running on the Google App Engine, they included a Clojure REPL. Getting more mainstream, it would seem... --~--~-~--~~~---~--~~ You received this me

Re: Distributed concurrent applications in Clojure?

2008-11-26 Thread levand
But couldn't you just write some macros to wrap a message-passing framework and have it be part of the language, for all practical purposes? It would seem that this falls under the category "if you want it, just do it". If anything, Clojure is potentially more powerful than Erlang for this kind o

Clojure indentation conventions

2008-12-03 Thread levand
I am coming to Clojure from the Java side, and am completely ignorant about lisp indentation & newline conventions. Some things are easy to pick up from posted examples and common sense...newline + tab after the parameters vector when defining a function, etc. But I did some web searches on lisp

Re: Swing GUI Builder and Clojure

2008-12-12 Thread levand
My vote is for Swing. Despite its flaws, it's the Java standard - there's no need to worry about compatibility (SWT) or licensing (Jambi) issues, and there's a wealth of material online to study it further. It's included with Java, which is a huge plus in a tutorial setting - personally, I'd be ve

Functional programming newbie question

2008-12-12 Thread levand
So, I'm trying to understand functional programming, particularly as it relates to the seq abstraction, and I'm hitting a slight difficulty as I'm playing around - something that seems as if it ought to be simple, is not. I'm playing with copying one seq into another. I've found several different

Re: Functional programming newbie question

2008-12-13 Thread levand
HTH, > > -- > Laurent > > On 13 déc, 04:41, mago wrote: > > > I guess one answer to your question would be: If the seq is persistent > > (immutable) why would you need to make a copy of it? > > > On Dec 12, 8:51 pm, levand wrote: > > > > So, I&

Re: Functional programming newbie question

2008-12-13 Thread levand
lementation actually doubly- linked? Thanks for the reply, Rich! I am really impressed by what you've done with Clojure. -Luke On Dec 13, 9:28 am, Rich Hickey wrote: > On Dec 12, 9:51 pm, levand wrote: > > > > > So, I'm trying to understand functional programming, par

Re: Functional programming newbie question

2008-12-14 Thread levand
Dec 13, 6:35 pm, Randall R Schulz wrote: > On Saturday 13 December 2008 14:29, levand wrote: > > > > ... > > > > Calling reverse when done is still O(N) > > > Really? Maybe my grasp of big-O notation is faulty, but isn't the > > recursive function itse

Workflow troubles - exceptions in other threads

2008-12-18 Thread levand
I must say, this is absolutely the first thing I've found about Clojure that is difficult or cumbersome - I've been more than pleased with how easy everything else has been. I'm a new to Emacs+Slime, and their learning curve has been the most difficult part, but so far I've overcome everything. H

Re: Workflow troubles - exceptions in other threads

2008-12-18 Thread levand
You, sir, are a genius. Thank you! Your blog posts on clojure+slime are excellent, too... this is what I get for trying to run with my own setup instead of just following your example. Many thanks, -Luke On Dec 18, 10:16 pm, "Bill Clementson" wrote: > On Thu, Dec 18, 2008 at 7:

Stumped - Java hangs when using Swing in Slime

2008-12-19 Thread levand
I noticed this first with a project I'm working on, and verified that it is happening as well with the temperature converter demo on the clojure site. After I run the file from within Slime, after a few seconds my Swing gui stops responding, and the Repl as well. Apparently, the whole Java proces

Re: Stumped - Java hangs when using Swing in Slime

2008-12-22 Thread levand
to enclojure for windows development because of this, although I'd much rather use emacs, now that I'm just getting used to it. Thanks, -Luke On Dec 19, 3:18 pm, levand wrote: > I noticed this first with a project I'm working on, and verified that > it is happening as w

Re: Stumped - Java hangs when using Swing in Slime

2008-12-23 Thread levand
Yeah, thanks for the suggestion, but that's not it... I can see the Swing window, and it is also hung (it doesn't process events from the OS). I'm going to do some more in-depth debugging today, doing stack dumps and such, and see if I can figure out what's locking. Thanks, -Luke On Dec 22, 3:5

Re: Stumped - Java hangs when using Swing in Slime

2008-12-29 Thread levand
is that something is blocking on the input stream from the Repl, and preventing events from being processed by the event- handling thread. As soon as something is entered in the Repl, it somehow clears this state and starts working again. Any thoughts on how to fix it? Thanks, -Luke On Dec 23, 9:

Re: Stumped - Java hangs when using Swing in Slime

2008-12-30 Thread levand
Wow... that actually fixes it. Still a minor problem, since according to the Sun website, it is legal to create a Swing object in another thread as long as long as it is not "realized" yet... Still, this definitely is a doable workaround. Thanks! -Luke On Dec 29, 9:17 pm, Rowdy Rednose wrote:

QT Jambi and the Repl

2009-01-16 Thread levand
Has anyone here had success in using Clojure with QT Jambi? I'm currently experimenting with porting my app from Swing to QT, and although Jambi might well be the theoretically superior framework, it seems like Swing is a lot easier to use with Clojure. The issue I'm currently running into is th