Re: Nailgun, swank & lein

2010-03-22 Thread Bradbev
Apparently starting the server with swank-clojure-project does not work, but starting it with "lein swank" and then connecting from Emacs works. Perhaps this is a problem with launching from inside Emacs. Either way, I now have something of a work around. Brad -- You received this message becau

Re: Nailgun, swank & lein

2010-03-22 Thread Bradbev
I've traced my hang issue down to these lines in NGServer synchronized(System.in) { if (!(System.in instanceof ThreadLocalInputStream)) { System.setIn(new ThreadLocalInputStream(in)); System.setO

Nailgun, swank & lein

2010-03-22 Thread Bradbev
Hi guys, I am running Clojure on OS X Snow Leopard, 64bit, Java 1.6. I've been developing a little app using Lein, Swank and Emacs, and now I am having trouble getting Nailgun to work properly. I'm not in front of my usual PC right now so I may get a few things wrong; but here is what I know. - M

Re: Funding Clojure 2010

2009-12-16 Thread Bradbev
Just donated. Thank you very much for Clojure, and I hope that this funding model works out for everybody! Cheers, Brad -- 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 fro

Re: New string utilities library ready

2009-08-20 Thread Bradbev
On Aug 20, 8:26 am, Stuart Sierra wrote: > Seems like opinion is pretty evenly divided here.  I'll leave the > library as-is for now, give it some time to see how things play out. > > In the mean time, as a compromise, I've added str-utils2/partial, > which is like clojure.core/partial for functi

Re: Pure-functional N-body benchmark implementation

2009-08-17 Thread Bradbev
On Aug 17, 1:32 am, Nicolas Oury wrote: > I was referring to the rules of the benchmark game. When you benchmark > language, using another language is not fair. > > If you were to do your own program, of course you could use Java. > However, in the particular circumstance, it is a bit annoying to

Re: Pure-functional N-body benchmark implementation

2009-08-16 Thread Bradbev
> > Why can't we write programs in Clojure and > drop down to Java if necessary? That's what I find funny about these threads, Clojure's Java interop is good, Java is easy to write performant code in. There is a clear path to getting the best JVM performance possible from a Clojure environment.

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Bradbev
On Aug 13, 3:43 pm, Daniel Lyons wrote: > On Aug 13, 2009, at 3:35 PM, Bradbev wrote: > > > > > > > What is the main point of reader macros?  Is it so you can define your > > own short-hand syntax, or is it the ability to get more direct access > > to the

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Bradbev
What is the main point of reader macros? Is it so you can define your own short-hand syntax, or is it the ability to get more direct access to the reader? If it is the first point, then I'd be happy to not have them - to me shorthand doesn't buy much. If it is the second point then why not simply

Re: Clojure performance tests and clojure a little slower than Java

2009-08-11 Thread Bradbev
On Jul 28, 7:47 pm, Andy Fingerhut wrote: > I have added a script that uses the Java version of the benchmark > programs to generate the large files that were in the distribution > file I gave a link to earlier, so it is much smaller.  I've also > published it on github and added a COPYING file t

Re: Connecting Swing elements idiomatically?

2009-08-11 Thread Bradbev
On Aug 11, 10:15 pm, Abhishek Reddy wrote: > Hi Brad, > > I saw your question on IRC the other day and came up with > this:http://gist.github.com/164652 > > That demo creates a frame with sliders that control the horizontal and > vertical position of a spot in a panel. > > It's certanly not the

Connecting Swing elements idiomatically?

2009-08-11 Thread Bradbev
I'll admit that I haven't done much GUI programming at all, but I'm finding that I want to throw together small simple Gui apps with Clojure. My problem is that every way I try to build my app, it feels wrong (ugly, over complex, etc). My current least-ugly solution is to share a ref between the

Re: Question about pmap

2009-08-09 Thread Bradbev
On Aug 9, 6:08 am, Nicolas Oury wrote: > > If I do my pmaptest with a very large Integer (inc 20) instead > > of (inc 0), it is as slow as the double version. My question is, > > whether Clojure may has a special handling for small integers? Like > > using primitives for small ints and do

Re: Question about pmap

2009-08-08 Thread Bradbev
> I'm not sure how to determine why calling 'new Double' each time > through NewDoubleTest's inner loop causes 2 threads to perform not > much better than 1.  The best possible explanation I've heard is from > Nicolas Oury -- perhaps we are measuring the bandwidth from cache to > main memory, not

Re: Question about pmap

2009-08-06 Thread Bradbev
On Aug 6, 3:07 am, Andy Fingerhut wrote: > On Aug 5, 6:09 am, Rich Hickey wrote: > > > > > On Wed, Aug 5, 2009 at 8:29 AM, Johann Kraus wrote: > > > >> Could it be that your CPU has a single floating-point unit shared by 4 > > >> cores on a single die, and thus only 2 floating-point units total

Re: Examining performance on the JVM

2009-07-17 Thread Bradbev
o:http://wikis.sun.com/display/HotSpotInternals/Home > > > > On Thu, Jul 16, 2009 at 5:39 AM, Bradbev wrote: > > > I see lots of discussion on this list about Clojure performance & how > > to get it to Java speed.  I am also interested in the next steps that > >

Examining performance on the JVM

2009-07-15 Thread Bradbev
I see lots of discussion on this list about Clojure performance & how to get it to Java speed. I am also interested in the next steps that happen, how does the JVM convert byte code down to machine code and how does one examine that? The profiling tools I use for C code let me look at what the co

Re: loneclojurian at ICFP programming contest

2009-07-07 Thread Bradbev
On Jul 7, 6:23 am, Jon Harrop wrote: > On Tuesday 07 July 2009 02:08:57 Bradbev wrote: > > > On Jul 6, 4:30 pm, fft1976 wrote: > > > On Jul 5, 11:42 pm, Bradbev wrote: > > > > more to modern x86 chips.  After you have the best algorithm for the > > &g

Re: loneclojurian at ICFP programming contest

2009-07-06 Thread Bradbev
On Jul 6, 4:30 pm, fft1976 wrote: > On Jul 5, 11:42 pm, Bradbev wrote: > > > more to modern x86 chips.  After you have the best algorithm for the > > job, you very quickly find that going fast is entirely bound by memory > > speed (actually latency) - cache misse

Re: loneclojurian at ICFP programming contest

2009-07-05 Thread Bradbev
On Jul 5, 3:18 am, fft1976 wrote: > On Jul 5, 2:31 am, Nicolas Oury wrote: > > > After, when I run the benchmark in -server with a big enough CacheCode area > > (1000m), and enough iterations to have everything JITed, I get more than > > 860.000 iterations per second. (I benchmarked 100 000 000

Re: How can I stop "leaking" memory?

2009-06-23 Thread Bradbev
A further optimization would be to keep track of the lowest value in your "keep" set. A simple compare against that value will eliminate many of the add/removes from the keep set. Brad On Jun 23, 1:35 am, Christophe Grand wrote: > On Tue, Jun 23, 2009 at 10:14 AM, Daniel Lyons wrote: > > > I

Re: Overlapping IO with processing

2009-05-07 Thread Bradbev
On May 7, 9:26 am, Meikel Brandmeyer wrote: > Hi, > > Am 07.05.2009 um 17:19 schrieb Bradbev: > > > This also leads me to think that it would be useful to have a function > > that precached a lazy seq, ie > > (pre-cache-seq 5 (range 1000)); returns a new lazy-seq

Overlapping IO with processing

2009-05-07 Thread Bradbev
I have a 25Mb CSV text file that I want to process. Simply running (time (dorun (read-lines "file"))) gives me about 1 second of read time, which is about as fast as you'll get (on my machine) I think. I believe that it should be possible to overlap the IO cost of reading from a file with process

Re: Should line-seq close the reader?

2009-04-28 Thread Bradbev
On Apr 28, 10:45 am, Meikel Brandmeyer wrote: > Hi, > > Am 28.04.2009 um 19:01 schrieb Bradbev: > > > Is it a good idea for line-seq to close its BufferedReader when there > > is no more data?  Or at least provide an optional parameter that > > allows/disallows cl

Re: Should line-seq close the reader?

2009-04-28 Thread Bradbev
you from reading all the lines, the Reader > remains open. > > -Stuart Sierra I should have known contrib would have had something. I need to read the contrib sources more. Thanks! Brad > > On Apr 28, 1:01 pm, Bradbev wrote: > > > Hello, > > I want to use line-seq, a

Should line-seq close the reader?

2009-04-28 Thread Bradbev
Hello, I want to use line-seq, and have it close the input reader. My first attempt was (with-open [stream (BufferedReader.)] (line-seq stream)) Which crashes immediately because you can't read lines from a closed seq. So, the only way to explicitly close the reader associated with line-seq is to

Re: Modifying data structures without changing their interface

2009-04-20 Thread Bradbev
On Apr 20, 2:17 pm, Mark Engelberg wrote: > On Mon, Apr 20, 2009 at 1:27 PM, Bradbev wrote: > > If you promise that > > functions will accept and return maps with certain keys, then you must > > keep that promise moving forward. > > I think you're missing part o

Re: Modifying data structures without changing their interface

2009-04-20 Thread Bradbev
I read the rest of this thread, and thought I'd throw in my two cents. It seems to me that you are mostly concerned with being able to provide a stable external API to clients while allowing the internal data structures to change. As a library designer you need to choose which parts of your API a

Re: speed question

2009-04-02 Thread Bradbev
different file? Would one have to resort to defining a > Java class (at compile time or runtime)? > > Paul > > On Thu, Apr 2, 2009 at 10:47 AM, Bradbev wrote: > > > It would seem that macros in this case should not be required.  A > > normal function that simply ret

Re: speed question

2009-04-02 Thread Bradbev
It would seem that macros in this case should not be required. A normal function that simply returns a constant should get inlined by the JIT. Cheers, Brad On Apr 2, 5:20 am, Dmitri wrote: > Thanks a lot, that's really helpful. I never thought of using a macro > to define constants > like that

Re: STM and useful concurrency

2009-03-24 Thread Bradbev
On Mar 24, 5:56 am, cliffc wrote: > Some generic STM bits of wisdom: > > - STMs in "standard" languages (e.g. C, C++) suffer from having to > track all memory references.  THis overhead means the STM code > typically starts 3x to 10x slower than non-STM code, which is a pretty > stiff penalty t

User contributed packages (Cabel, CPAN, etc)

2009-03-22 Thread Bradbev
Is the clojure-contrib portion of Clojure meant to act as a package system like Cabel, CPAN, etc? I suspect not. Clojure-contrib is more like the standard library that comes with Clojure. I think that going forward, Clojure is going to want to have a large and easily accessible library of packa

How can I make the smallest structure possible?

2009-03-09 Thread Bradbev
I'm writing a program that will have millions of small structures in it. If I were writing in C (or Java I guess), I estimate the object size to be about 40 bytes. In Clojure, using a struct map I've made a rough measure & I think that the objects are weighing in at about 200bytes. 1) I know th

Re: emacs / swank / slime startup problem - ClassNotFoundException: swank.swank

2009-03-03 Thread Bradbev
On Mar 3, 4:46 am, Korny Sietsma wrote: > Hi folks; > > I have an intermittent problem that's driving me nuts. > I'm running the emacs-starter-kit setup for editing clojure, recently > updated from git, and when I first run "M-x slime", I often get the > following messages: > user=> user=> java.l

Re: Laziness madness

2009-03-02 Thread Bradbev
On Mar 2, 3:29 am, Mark Volkmann wrote: > On Sun, Mar 1, 2009 at 11:06 PM, max3000 wrote: > > > Hi, > > > I find the laziness in clojure very hard to wrap my head around. I > > understand the idea and it's probably nice in theory. However, in real > > life it doesn't seem really useful beyond ha

Re: Clojure, Slime and multiple file projects

2009-02-09 Thread Bradbev
namespace that uses all my files should do the trick. Thanks, I'll try that out. > On Mon, Feb 9, 2009 at 8:05 AM, Bradbev wrote: > > > Hi folks, > > I'm getting to the stage on a Clojure project that I want to start > > breaking the code into multiple fi

Clojure, Slime and multiple file projects

2009-02-08 Thread Bradbev
Hi folks, I'm getting to the stage on a Clojure project that I want to start breaking the code into multiple files. My primary environment is Emacs & Slime and interactive development. Is there a standard way for me to load all of my project's files into the running VM? Right now I manually go t

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-03 Thread Bradbev
On Feb 1, 5:22 pm, David Nolen wrote: > I've changed the name of my project since that was a joke > anyway.http://github.com/swannodette/spinoza/tree/master > > Spinoza isn't just for people who want object oriented behaviors.  It's also > for anyone who plans on instantiating many structs.  Spi

Re: Agents & send-off

2008-12-15 Thread Bradbev
On Dec 15, 4:29 pm, Rich Hickey wrote: > On Dec 15, 5:57 pm, Bradbev wrote: Thanks for the quick reply. Very helpful. Cheers, Brad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" grou

Agents & send-off

2008-12-15 Thread Bradbev
I have the following scenario: - a server that is listening on a socket for incoming connections. - when the server accepts a connection it uses send-off to run a handler function to handle the connection - the handler function loops using recur to handle packets - the handler function uses

Re: Isolating I/O and other side-effects?

2008-11-24 Thread Bradbev
On Nov 24, 4:44 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Nov 24, 7:22 pm, dokondr <[EMAIL PROTECTED]> wrote: > > > Providing that Clojure is NOT a pure functional language like Haskell, > > yet how can I isolate imperative-style computational structures  from > > the main body of the functi

assert with message [patch]

2008-11-23 Thread Bradbev
Here is a small change to assert that allows it to take an optional message that will part of the exception that is thrown. Cheers Brad Index: src/clj/clojure/core.clj === --- src/clj/clojure/core.clj(revision 1102) +++ src/clj/

Re: Eager map?

2008-11-17 Thread Bradbev
On Nov 17, 3:50 pm, Adam Jones <[EMAIL PROTECTED]> wrote: > On Nov 17, 3:26 pm, Robert Ewald <[EMAIL PROTECTED]> wrote: > > > Hello, > > > Doing some small experiments I stumbled over map returning a lazy seq > > instead > > of performing the function. I had to convert that to a doseq. Is there

Lazy Seq and refs

2008-11-14 Thread Bradbev
I thought up an interesting issue the other night. If you map a function over a seq of refs, then change the refs & look at the map return value (which will convert it from lazy to ...? Hmm, what's the word - motivated?) then you will get the current value of the refs. The example code is (def