Re: Reflection warning: reference to field getClass can't be resolved.

2009-08-10 Thread Mike Hinchey
This is nothing to worry about, but it does seem to be something that can be improved in clojure. I submitted a patch with a simple fix: http://www.assembla.com/spaces/clojure/tickets/171-reflection-warning-from-ns There is a more complex fix that could be made to the clojure compiler so it

Re: How to create structure with a seq of keys

2009-08-10 Thread John Harrop
On Sun, Aug 9, 2009 at 8:55 PM, David Nolen dnolen.li...@gmail.com wrote: Sounds like you want apply: (apply fn args) Indeed. Since create-struct (not create-structure!) is a function, this should work. It wouldn't work with a macro, though.

Re: binding and bundles of variables

2009-08-10 Thread Niels Mayer
On Thu, Aug 6, 2009 at 10:12 PM, samppi rbysam...@gmail.com wrote: I have about six variables that are often rebound together using binding; these variables are used to access and set data in a state object (whose type is of the user's choice). These variables' values (the accessors and

Re: Commenting Code (Was: Re: Clojure as a First Language)

2009-08-10 Thread John Harrop
On Sun, Aug 9, 2009 at 12:47 PM, Lauri Pesonen lauri.peso...@iki.fi wrote: 2009/8/8 Luc Prefontaine lprefonta...@softaddicts.ca: I totally agree no comments is not good at all but JavaDoc style comments in Clojure ? I pray you all, please stay away of it : I was quite taken by this

Re: ANN: Clojure Ant Tasks

2009-08-10 Thread Garth Sheldon-Coulson
I haven't had a chance to try it out yet, but this is very promising. Thanks for doing it. On Sun, Aug 9, 2009 at 11:58 PM, Richard Newman holyg...@gmail.com wrote: On 9 Aug 2009, at 8:14 PM, J. McConnell wrote: http://github.com/jmcconnell/clojure-ant-tasks/tree/master I hope someone

SOAP Server

2009-08-10 Thread Steve Nunez
Does anyone have an example of using Clojure as a SOAP server? There was one tread that Google found, but a quick search of the wiki and this list didn¹t turn up anything. A bit surprising really, as I thought that would be one of the first things written. If a SOAP library doesn¹t exist, how

Re: ANN: Clojure Ant Tasks

2009-08-10 Thread Laurent PETIT
Hi, have you seen the recent patch submitted by Mike Hinchey ? http://www.assembla.com/spaces/clojure/tickets/168 Regards, -- Laurent 2009/8/10 J. McConnell jdo...@gmail.com Most of the Ant setups I've seen for building and testing Clojure code, including some of my own, have suffered

Re: Pure-functional N-body benchmark implementation

2009-08-10 Thread Jarkko Oranen
On Aug 10, 12:41 pm, fft1976 fft1...@gmail.com wrote: I just uploaded to the group an implementation of the n-body benchmark in Clojure (see nbody_init.clj) http://shootout.alioth.debian.org/u32/benchmark.php?test=nbody〈=j... My goal was to write a pure-functional version and to avoid any

Re: ANN: Clojure Ant Tasks

2009-08-10 Thread Chas Emerick
Looks like a good start. I initially didn't grok what was going on, until I realized that you were aiming for an actual ant library. We have a couple of ant macros that do all of our clojure building for us (including auto-detecting namespaces within source directories, compiling only

Re: ANN: Clojure Ant Tasks

2009-08-10 Thread J. McConnell
I hadn't looked at the patch before, but I was delighted to see the posting about it a few days ago. I think it will benefit everyone. However, I was well underway with these tasks at the time (I haven't had a lot of time to work on them, so it took a couple of weeks). Regardless, I really wanted

Re: Commenting Code (Was: Re: Clojure as a First Language)

2009-08-10 Thread Luc Prefontaine
It's along the lines that we follow. Declaring the public functions first however forces you to use a declare statement for all the private functions used by your public API. We use section comments to split the module (constants, global defs, private functions, public ones, ...) and keep the

Re: Transient Data Structures

2009-08-10 Thread Christophe Grand
Hi Andy, On Thu, Aug 6, 2009 at 7:40 PM, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: Thank you, Christophe! I've been wanting to try those out. I made changes to 3 lines of my Clojure program for the k-nucleotide benchmark, which spends most of its time in a function

Processing elements in a lazy seq in parallel

2009-08-10 Thread Tom Emerson
Hello Clojurians, I want to process approximately 74K XML files that are stored on disk in a series of nested directories, each of which contains upto 1000 files. For example, rootdir 0 file1.xml file2.xml 1 file3.xml file4.xml and so on. file-seq gives

Re: Pure-functional N-body benchmark implementation

2009-08-10 Thread fft1976
On Aug 10, 4:46 am, Jarkko Oranen chous...@gmail.com wrote: I'm not going to start optimising, Somebody'd better! You always hear this dogma that one should write elegant code first and optimize later, and when you do that, a few little changes can make Clojure as fast as Java. Here's your

Add 'source' to build.xml

2009-08-10 Thread Yaroslav Kavenchuk
For built clojure with jdk7 need small change: --- build.xml 2009-08-05 21:29:32 +0300 +++ build.xml 2009-08-10 21:11:25 +0300 @@ -79,7 +79,7 @@ target name=compile-java depends=init description=Compile Java sources. javac srcdir=${jsrc} destdir=${build}

Re: binding and bundles of variables

2009-08-10 Thread jvt
Meikel, What concerns me is that this macro lets you write code which depends on names which are not present at compile time (someplace). Coming from scheme, not only would you _not_ do this, but you _can't_ do it without using eval in your macro body, which is considered bad form. That we can

Re: binding and bundles of variables

2009-08-10 Thread jvt
Really, this should be (with-bindings-from-map var-map (+ *v1* 100)) ; - 200, does what we expect (with-bindings-from-map wrong-map (+ *v1* 100)) ; - 110, does the wrong thing entirely, silently Anyway, you may want to think about why common-lisp does not have a with-all-slots macro for use

Re: Pure-functional N-body benchmark implementation

2009-08-10 Thread Andy Fingerhut
On Aug 10, 11:35 am, fft1976 fft1...@gmail.com wrote: On Aug 10, 4:46 am, Jarkko Oranen chous...@gmail.com wrote: I'm not going to start optimising, Somebody'd better! You always hear this dogma that one should write elegant code first and optimize later, and when you do that, a few

Re: Processing elements in a lazy seq in parallel

2009-08-10 Thread tmountain
You can use agents in combination with the send function which will operate on a fixed size thread pool. I'm sure there are other ways as well, but I've found agents very easy to work with. Travis On Aug 10, 2:18 pm, Tom Emerson tremer...@gmail.com wrote: Hello Clojurians, I want to process

Re: Pure-functional N-body benchmark implementation

2009-08-10 Thread Andy Fingerhut
On Aug 10, 2:19 pm, Jonathan Smith jonathansmith...@gmail.com wrote: 1.) use something mutable 2.) unroll all the loops (mapping is a loop) 3.) try not to coerce between seq/vec/hash-map too much. in real world, stuff like the shootout is pretty useless, as generally you'd reach for a

current rule of thumb for optimization?

2009-08-10 Thread Raoul Duke
hi, while i realize the real answer is it depends!, are there any current rules of thumb based on experience about how to tackle performance tweaking in Clojure? (e.g. as a small random example, i think i've heard at times that type notes should speed things up, but then other times have heard

Re: Processing elements in a lazy seq in parallel

2009-08-10 Thread Laurent PETIT
Hi, 2009/8/10 Tom Emerson tremer...@gmail.com Hello Clojurians, I want to process approximately 74K XML files that are stored on disk in a series of nested directories, each of which contains upto 1000 files. For example, rootdir 0 file1.xml file2.xml 1

Re: current rule of thumb for optimization?

2009-08-10 Thread David Nolen
The only thing I've ever seen in Clojure that is slow is tight loops on primitives. Most of the time that people bring up Clojure performance, it's usually about tight loops on primitives. For starters, this isn't even something you could really optimize in popular dynamic languages like Python or

Re: Pure-functional N-body benchmark implementation

2009-08-10 Thread Isaac Gouy
On Aug 10, 3:00 pm, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: On Aug 10, 2:19 pm, Jonathan Smith jonathansmith...@gmail.com wrote: 1.) use something mutable 2.) unroll all the loops (mapping is a loop) 3.) try not to coerce between seq/vec/hash-map too much. in real world,

Re: Pure-functional N-body benchmark implementation

2009-08-10 Thread fft1976
On Aug 10, 5:15 pm, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: OK, I've got a new Clojure program for the n-body benchmark, and it is significantly faster than my previous one -- down from 138 x Java run time, to 37 x Java run time.  Still room for improvement somewhere there, I'm

binary serialization

2009-08-10 Thread fft1976
Is there a way to do binary serialization of Clojure/Java values? ASCII (read) and (write) are nice, but they are wasting space, truncating floats and are probably slow compared to binary serialization. --~--~-~--~~~---~--~~ You received this message because you

creating classes in Clojure

2009-08-10 Thread fft1976
Is there a way to create a Java class (not instance) in Clojure without writing actual Java? e.g. public class person { public string name; public int num_children; public double weight; } --~--~-~--~~~---~--~~ You received this message because you are

Re: binary serialization

2009-08-10 Thread Kyle R. Burton
Is there a way to do binary serialization of Clojure/Java values? ASCII (read) and (write) are nice, but they are wasting space, truncating floats and are probably slow compared to binary serialization. The following utility functions have worked in many cases for me: (defn object-file [obj

Re: creating classes in Clojure

2009-08-10 Thread Kyle R. Burton
On Mon, Aug 10, 2009 at 10:31 PM, fft1976fft1...@gmail.com wrote: Is there a way to create a Java class (not instance) in Clojure without writing actual Java? e.g. public class person {  public string name;  public int num_children;  public double weight; } Yes, tho perhaps not

Re: binary serialization

2009-08-10 Thread Kyle R. Burton
On Mon, Aug 10, 2009 at 10:42 PM, Kyle R. Burtonkyle.bur...@gmail.com wrote: Is there a way to do binary serialization of Clojure/Java values? ASCII (read) and (write) are nice, but they are wasting space, truncating floats and are probably slow compared to binary serialization. The

Re: Pure-functional N-body benchmark implementation

2009-08-10 Thread fft1976
On Aug 10, 2:19 pm, Jonathan Smith jonathansmith...@gmail.com wrote: 1.) use something mutable 2.) unroll all the loops (mapping is a loop) 3.) try not to coerce between seq/vec/hash-map too much. Are you saying this w.r.t. my code or in general? If the former, be specific, better yet, show

Re: Transient Data Structures

2009-08-10 Thread samppi
Excellent, excellent. But I'm wondering, is it planned (or feasible) for structmap transients to be supported too? I often use and modify protean structmaps in loops, and I'd love to know if the concept of transients can be applied to them. On Aug 6, 4:53 am, Rich Hickey richhic...@gmail.com

Re: binary serialization

2009-08-10 Thread fft1976
On Aug 10, 7:57 pm, Kyle R. Burton kyle.bur...@gmail.com wrote: On Mon, Aug 10, 2009 at 10:42 PM, Kyle R. Burtonkyle.bur...@gmail.com wrote: Is there a way to do binary serialization of Clojure/Java values? ASCII (read) and (write) are nice, but they are wasting space, truncating floats

Re: binary serialization

2009-08-10 Thread Kyle R. Burton
Does all this work with cycles, Java arrays, etc.? It will work with anything that implements the Serializable interface in Java. Arrays do implement that interface, as do all the primitives. With respect to cycles, I'd suspect it does, but would test it. If you have a repl handy it should

Re: binding and bundles of variables

2009-08-10 Thread samppi
I'm also concerned about the implementation, which seems to rely on what appears to me to be a little magical. An alternative that I was considering was to just break backwards compatibility and combine all of the variables into one variable containing a map in a new major version of my library.

Re: How to create structure with a seq of keys

2009-08-10 Thread Dragan Djuric
Thanks. (I discovered the solution shortly after posting here, but there is that annoying delay until the message is approved by mods, so I couldn't answer my question...) On Aug 10, 2:55 am, David Nolen dnolen.li...@gmail.com wrote: Sounds like you want apply: (apply fn args) On Sun, Aug

How to write a macro that writes another macro?

2009-08-10 Thread Dragan Djuric
For example: (defmacro creator [param] `(defmacro created [p] `(the code...)) ;; note the nested quote... how to resolve that? any examples? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: How to write a macro that writes another macro?

2009-08-10 Thread Jonathan Smith
On Aug 10, 3:20 pm, Dragan Djuric draga...@gmail.com wrote: For example: (defmacro creator [param]  `(defmacro created [p] `(the code...)) ;; note the nested quote... how to resolve that? any examples? Although I wouldn't cite my own code as a necessarily *good* or easy to understand