Re: Spread work onto multiple threads (in pure Clojure)

2011-10-12 Thread j-g-faustus
times the number of physical CPU cores), whereas the number of parallel tasks the work is divided into could be limited only by memory for storing the tasks scheduled for future execution. Andy On Tue, Oct 11, 2011 at 10:55 AM, j-g-faustus johannes...@gmail.comwrote: On Tuesday, October

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-11 Thread j-g-faustus
On Tuesday, October 11, 2011 3:55:09 AM UTC+2, Lee wrote: Does your pmap-pool permit nesting? (That is, does it permit passing pmap-pool a function which itself calls pmap-pool?). If so then that would be a reason to prefer it over my pmapall. I expect it would be possible to nest it

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-10 Thread j-g-faustus
I made an alternative implementation using a thread pool and a queue, based on the example at http://clojure.org/concurrent_programming In short, your pmapall and the pool-based implementation (below) both give approximately perfect scaling on my 4/8-core system (Intel i7 920 and HT). Both

Re: why the def of run-jetty looks like defn #^Server run-jetty

2010-08-09 Thread j-g-faustus
On Aug 9, 8:25 am, limux liumengji...@gmail.com wrote: what's the meaning of #^Server in the defn and let? (defn #^Server run-jetty ...   (let [#^Server s (create-server (dissoc options :configurator))] It's a type hint. In the defn it specifies the type of the return value, in the let it

Re: System calls

2010-08-07 Thread j-g-faustus
On Aug 7, 7:27 am, Meikel Brandmeyer m...@kotka.de wrote: (defn to-env   [env-vars-map]   (- env-vars-map     (map #(str (name (key %)) = (val %)))     into-array)) And an invocation: user= (to-env {:PATH /bin:/usr/bin :HOME /Users/mb :foo bar}) #String[] [Ljava.lang.String;@58c16b18

Re: System calls

2010-08-07 Thread j-g-faustus
On Aug 7, 4:46 pm, Dave david.dreisigme...@gmail.com wrote:   (execute (str /../pdb_to_xyzr pdb-file /..))) Here it seemed to run (the above error isn't shown) but nothing happened and the REPL become unresponsive again.   I think the issue is that Runtime.exec doesn't start a shell, just

Re: System calls

2010-08-06 Thread j-g-faustus
On Aug 7, 5:06 am, j-g-faustus johannes.fries...@gmail.com wrote: I don't think there's a direct way to create a String array in Clojure Correction - there is: (into-array String [a b]) jf -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: filtering with multiple predicates

2010-07-24 Thread j-g-faustus
On Jul 23, 11:27 pm, .Bill Smith william.m.sm...@gmail.com wrote: (filter #(and (f %) (g %) (h %)) my-list) Here's another one, just to add to the collection: (defn andp [ fns] (fn [ args] (every? #(apply % args) fns))) (filter (andp f g h) my-list) -- You received this message because

Re: filtering with multiple predicates

2010-07-24 Thread j-g-faustus
On Jul 24, 8:53 am, Mark Triggs mark.h.tri...@gmail.com wrote: I cheated and used 'every?' :) I was apparently too late. Oh well :) -- 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

Re: Anyone working with Eclipse and log4j? I have a beginner labrepl question...

2010-07-24 Thread j-g-faustus
You can safely ignore them. What you are seeing is the startup log for the web/application server, and it complains about the server log configuration. But there's nothing there that stops the labrepl from working or that you need to do anything about. Regards jf On Jul 24, 6:58 am, Victor S

Re: IDE agnostic question on user assistance (emacs/vimClojure users help appreciated too !)

2010-07-22 Thread j-g-faustus
On Jul 20, 10:15 am, Laurent PETIT laurent.pe...@gmail.com wrote: Oh, maybe I understand: by partial drafts, you mean pseudo-code, directly written in clojure, is it this ? It could be pseudo-code or partial implementations or code that is more or less complete but won't compile because the

Re: IDE agnostic question on user assistance (emacs/vimClojure users help appreciated too !)

2010-07-20 Thread j-g-faustus
On Jul 20, 9:02 pm, Laurent PETIT laurent.pe...@gmail.com wrote: Yeah. But again, please (I've asked this before, nobody answered), what do you precisely mean by reload all in current REPL: a reload at the namespace level ? Or really *only* reloading the vars you carefully and manually sent to

Re: IDE agnostic question on user assistance (emacs/vimClojure users help appreciated too !)

2010-07-19 Thread j-g-faustus
I haven't tried CCW, but I am happy with Enclojure 6.8. (In 6.9 the file navigator which lists the functions and vars in the file doesn't work yet, and the navigator is perhaps 50% of the value I derive from an IDE.) Am 19.07.2010 um 20:50 schrieb Laurent PETIT: If you work from the files,

Re: Response

2010-07-17 Thread j-g-faustus
On 17 Jul, 22:43, Isaac Hodes iho...@mac.com wrote: It's just a shame, it seems to me, that there is such a nice way to represent the procedure in Python or even C, yet Clojure (or any Lisp really) struggles to idiomatically answer this question of convolution. I'll have to disagree with the

Re: ClojureDocs.org

2010-07-13 Thread j-g-faustus
On 13 Jul, 01:28, j-g-faustus johannes.fries...@gmail.com wrote: On Jul 13, 12:25 am, j-g-faustus johannes.fries...@gmail.com wrote: I made my own cheat sheet for private use over the past month or so, core functions only. It's at the 80% stage, I don't expect it will ever be 100%, but I

Re: ClojureDocs.org

2010-07-13 Thread j-g-faustus
On Jul 13, 8:37 pm, Paul Moore p.f.mo...@gmail.com wrote: Can I suggest omitting the Table of contents sidebar when printing? I've not tried printing the document to see how it looks, but removing the sidebar would be an essential starting point... Why would anyone want to print it? I

Re: ClojureDocs.org

2010-07-12 Thread j-g-faustus
The site looks very nice, I especially like the find real world examples functionality and the fact that it collects documentation for common non-core libraries as well. I made my own cheat sheet for private use over the past month or so, core functions only. It's at the 80% stage, I don't expect

Re: ClojureDocs.org

2010-07-12 Thread j-g-faustus
On Jul 13, 12:25 am, j-g-faustus johannes.fries...@gmail.com wrote: I made my own cheat sheet for private use over the past month or so, core functions only. It's at the 80% stage, I don't expect it will ever be 100%, but I have found it useful: http://faustus.webatu.com/clj-quick-ref.html

Re: Idiomatic Clojure namespace names

2010-07-09 Thread j-g-faustus
On Jul 9, 5:58 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: The other non- project requirement (a page linking the project to the domain name) is pretty much contrary to the quote from the Java specification. By my reading, they are talking about something different - the

Re: Idiomatic Clojure namespace names

2010-07-09 Thread j-g-faustus
On Jul 9, 8:14 pm, James Reeves jree...@weavejester.com wrote: Ruby and Rubygems has been using single-segment namespaces for years, with no major problems. I don't think name clashes are a problem in practise, because projects tend to have original names. It works up to a point. It is claimed

Re: Idiomatic Clojure namespace names

2010-07-08 Thread j-g-faustus
On Jul 8, 5:21 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: You're overlooking that one of the major benefits of Clojure is that it interoperates with other JVM languages. So any idiom it uses needs to have some assurance that it won't clash with an idiom used by those

Re: Idiomatic Clojure namespace names

2010-07-07 Thread j-g-faustus
On Jul 7, 7:55 pm, James Reeves jree...@weavejester.com wrote: For the purposes of this discussion, let us assume that foo is a suitably unique library name, and it is highly unlikely there exist any other libraries with the same name. It sounds like Clojure doesn't have an idiom for namespace

Re: Benchmarking clojure code

2010-07-02 Thread j-g-faustus
On Jul 2, 3:44 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 1 Jul 2010 11:27:09 -0700 (PDT) j-g-faustus johannes.fries...@gmail.com wrote: Criterium, a benchmarking library for Clojure, seems pretty good: The author responded here. I noticed, my reply was sent

Re: Benchmarking clojure code

2010-07-02 Thread j-g-faustus
On Jul 2, 7:41 pm, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 1 Jul 2010 22:19:56 -0400 It depends on what you're benchmarking. If the loop time ... is on the order of the same size as the standard deviation, then it can fool you into falsely concluding that there's

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-07-01 Thread j-g-faustus
chunk of the CPU time: http://i589.photobucket.com/albums/ss334/j-g-faustus/profiling/eqv-arrays.png From a practical standpoint I guess it means that deftype is the way to go if you want fast numbers today. In this case even the immutable deftype was faster than mutable Java arrays, so you can

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-07-01 Thread j-g-faustus
operations are done internally in a single mutable deftype instance, but it is still very good - in this scenario there was close to zero overhead from using Clojure. On Jul 1, 4:29 pm, Nicolas Oury nicolas.o...@gmail.com wrote: On Thu, Jul 1, 2010 at 2:27 AM, j-g-faustus johannes.fries

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-07-01 Thread j-g-faustus
On Jul 1, 6:24 pm, Heinz N. Gies he...@licenser.net wrote: One reason here is that clojures literals as 1 2 and 3 you use for array indexes are longs, the aget methods want int's Agreed. If we can take the profiling snapshot I linked to at face value, the boxing and casting adds up to ~40% of

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-07-01 Thread j-g-faustus
On Jul 1, 5:42 pm, Greg g...@kinostudios.com wrote: Ooo... sorry for the side-question, but I noticed that your code doesn't seem to use coercions for primitives and uses type-hints instead. I was just asking the other day on #clojure why Clojure had coercion functions at all and why type

Re: Managing the classpath

2010-07-01 Thread j-g-faustus
On Jul 1, 4:49 pm, Paul Moore p.f.mo...@gmail.com wrote: (My biggest concern about an uberjar is that I end up with each app having a separate bundled copy of all its dependencies. That makes version management a huge pain - imagine a bugfix release of clojure.jar - but is otherwise not an

Re: Benchmarking clojure code

2010-07-01 Thread j-g-faustus
On Jul 1, 7:51 pm, Peter Schuller peter.schul...@infidyne.com wrote: Is anyone using anything more sophisticated than clojure.core/time for benchmarking clojure code? Criterium, a benchmarking library for Clojure, seems pretty good: http://github.com/hugoduncan/criterium Based on ideas in

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-30 Thread j-g-faustus
and primitives cannot cross function boundaries? That would explain the relative slowness of arrays. Here is a test case http://gist.github.com/458669 And a profiler screenshot http://i589.photobucket.com/albums/ss334/j-g-faustus/profiling/array-test-50k.png 15% CPU time goes to Double.valueOf(double

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-30 Thread j-g-faustus
, Nicolas Oury nicolas.o...@gmail.com wrote: On Wed, Jun 30, 2010 at 3:19 PM, j-g-faustus johannes.fries...@gmail.comwrote: The number of calls to Double.valueOf(double) seems to suggest that it is called only on aset, not on aget, though I can't think of any reason how that could be. Does

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-30 Thread j-g-faustus
OK, I'll try again. Thanks. jf On Jun 30, 6:14 pm, David Nolen dnolen.li...@gmail.com wrote: On Wed, Jun 30, 2010 at 10:19 AM, j-g-faustus johannes.fries...@gmail.comwrote: Tried the equiv branch briefly: The 1.1 style version is ~4% quicker, but still ~4x slower than Java and ~2x

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-29 Thread j-g-faustus
-faustus/Clojure-test-code/ * 1.2 implementation: http://github.com/j-g-faustus/Clojure-test-code/blob/master/shootout/nbody_type.clj I haven't tried the new numeric branches, there seems to be a sufficient number of people with opinions on those already :) But I can add the observation

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-29 Thread j-g-faustus
On Jun 29, 8:05 pm, j-g-faustus johannes.fries...@gmail.com wrote: Definterface and defprotocol, on the other hand Correction: definterface and deftype. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-28 Thread j-g-faustus
and deftype look promising, I'll try them out when I have finished the 1.1 version. Thanks for feedback, jf On Sat, Jun 26, 2010 at 6:56 PM, j-g-faustus johannes.fries...@gmail.comwrote: On profiling I have a bunch of intCast(Object) and doubleCast(double) totaling ~9% CPU time

Re: New Primitive data types (equal branch) - impact on optimized code.

2010-06-27 Thread j-g-faustus
Possibly of interest here, although I've only tested it using Clojure 1.1: I just did an implementation of the n-body problem from http://shootout.alioth.debian.org/u32q/benchmark.php?test=nbodylang=all The fastest code I've managed so far is here: http://github.com/j-g-faustus/Clojure-test-code

Re: Colon (:) in comments?

2010-06-14 Thread j-g-faustus
OK. Thanks for the help to both of you. Regards, jf On 13 Jun, 21:27, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 13.06.2010 um 19:50 schrieb Heinz N. Gies: comment just is a function that says 'don't evaluate the stuff in here, it still needs to be correct clojure code you can either

Colon (:) in comments?

2010-06-13 Thread j-g-faustus
Hi, I get an exception whenever I put a colon in a multiline comment: (comment TODO: x y z ) = #CompilerException java.lang.Exception: Invalid token: TODO: Is this a Clojure bug? Or related to Enclojure on NetBeans? Or some sort of hidden feature in comments? Regards jf -- You received

Re: What's up with require vs use vs import vs refer?

2010-05-15 Thread j-g-faustus
Thanks for responses and links. It looks like I can't comment on those threads without signing up as a Clojure contributor (by postal mail, even) which is a bit more commitment than I'd like right now, so I'll post my comments here instead. I disagree with Stuart Sierra in the need proposal that