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 I

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 LF, 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) (op2

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

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:

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

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

Re: Functional programming newbie question

2008-12-13 Thread levand
déc, 04:41, mago mago...@gmail.com 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 luke.vanderh...@gmail.com wrote: So, I'm trying to understand functional programming

Re: Functional programming newbie question

2008-12-13 Thread levand
for the reply, Rich! I am really impressed by what you've done with Clojure. -Luke On Dec 13, 9:28 am, Rich Hickey richhic...@gmail.com wrote: On Dec 12, 9:51 pm, levand luke.vanderh...@gmail.com wrote: So, I'm trying to understand functional programming, particularly as it relates to the seq

Re: Functional programming newbie question

2008-12-14 Thread levand
, Randall R Schulz rsch...@sonic.net 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 itself O(n), and then a reversal another O(n) operation on top

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

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,

Re: Stumped - Java hangs when using Swing in Slime

2008-12-29 Thread levand
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:28 am, levand

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

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