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

2011-10-12 Thread j-g-faustus
ctual number of active > Java Threads could be kept reasonably low (e.g. maybe 2 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. >

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 giv

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 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 gives the type of the

Re: System calls

2010-08-07 Thread j-g-faustus
On Aug 7, 4:46 pm, Dave 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 a subprocess, so thi

Re: System calls

2010-08-07 Thread j-g-faustus
On Aug 7, 7:27 am, Meikel Brandmeyer 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"}) > # > user=> (seq *1) > ("PATH=/bin:/

Re: slow raw io

2010-08-07 Thread j-g-faustus
On Aug 7, 2:02 pm, Stuart Halloway wrote: > > No. We want to collect more information and do more comparisons before > > moving away from the recommended Java buffering. Maybe this comparison can be of interest? http://nadeausoftware.com/articles/2008/02/java_tip_how_read_files_quickly Somebody

Re: System calls

2010-08-06 Thread j-g-faustus
On Aug 7, 5:06 am, j-g-faustus 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 "Cl

Re: System calls

2010-08-06 Thread j-g-faustus
On Aug 6, 11:50 pm, Dave wrote: > I get the error: > > Cannot run program "pdb_to_xyzr": error=2, No such file or directory >   [Thrown class java.io.IOException] You may have a path problem. Try running "env" in the same fashion - I get a very basic path (just "/bin" and "/usr/bin") and none of

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 wr

Re: filtering with multiple predicates

2010-07-24 Thread j-g-faustus
On Jul 24, 8:53 am, Mark Triggs 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 that posts from new memb

Re: filtering with multiple predicates

2010-07-24 Thread j-g-faustus
On Jul 23, 11:27 pm, ".Bill Smith" 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 you are subscribed t

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

2010-07-21 Thread j-g-faustus
On Jul 20, 10:15 am, Laurent PETIT 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 functions or libs it

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 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 the REPL over tim

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, t

Re: Response

2010-07-17 Thread j-g-faustus
On 17 Jul, 22:43, Isaac Hodes 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 conclusion.

Re: ClojureDocs.org

2010-07-13 Thread j-g-faustus
On Jul 13, 8:37 pm, Paul Moore 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 occasionally print lon

Re: ClojureDocs.org

2010-07-13 Thread j-g-faustus
On 13 Jul, 01:28, j-g-faustus wrote: > On Jul 13, 12:25 am, j-g-faustus 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%, bu

Re: ClojureDocs.org

2010-07-12 Thread j-g-faustus
On Jul 13, 12:25 am, j-g-faustus 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: 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 expec

Re: Idiomatic Clojure namespace names

2010-07-09 Thread j-g-faustus
On Jul 9, 8:14 pm, James Reeves 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 that university-leve

Re: Idiomatic Clojure namespace names

2010-07-09 Thread j-g-faustus
On Jul 9, 5:58 am, Mike Meyer 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 "groupId" which identifies the project i

Re: Idiomatic Clojure namespace names

2010-07-08 Thread j-g-faustus
On Jul 8, 5:21 am, Mike Meyer 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 > other languages. It's a good point. > Tha

Re: Idiomatic Clojure namespace names

2010-07-07 Thread j-g-faustus
On Jul 7, 7:55 pm, James Reeves 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 names yet, so I gu

Re: Benchmarking clojure code

2010-07-02 Thread j-g-faustus
On Jul 2, 7:41 pm, Mike Meyer 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 no statistically > significant differenc

Re: Benchmarking clojure code

2010-07-02 Thread j-g-faustus
On Jul 2, 3:44 am, Mike Meyer wrote: > On Thu, 1 Jul 2010 11:27:09 -0700 (PDT) > j-g-faustus wrote: > > Criterium, a benchmarking library for Clojure, seems pretty good: > > The author responded here. > I noticed, my reply was sent an hour earlier. I'm still on modera

Re: Benchmarking clojure code

2010-07-01 Thread j-g-faustus
On Jul 1, 7:51 pm, Peter Schuller 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 this article: http://www.i

Re: Managing the classpath

2010-07-01 Thread j-g-faustus
On Jul 1, 4:49 pm, Paul Moore 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 unreasonable option

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 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 hints didn't work

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" 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 the CPU time. G

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

2010-07-01 Thread j-g-faustus
apart from the dotimes loop counter all numeric 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 wrote: > On Thu, Jul 1, 2010 at 2:27 AM,

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

2010-07-01 Thread j-g-faustus
a significant 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 ar

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 wrote: > On Wed, Jun 30, 2010 at 10:19 AM, j-g-faustus > wrote: > > > > > > > Tried the equiv branch briefly: The "1.1 style" version is ~4% > > quicker, but still ~4x slower t

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

2010-06-30 Thread j-g-faustus
0, 5:20 pm, Nicolas Oury wrote: > On Wed, Jun 30, 2010 at 3:19 PM, j-g-faustus > wrote: > > > > > 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

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

2010-06-30 Thread j-g-faustus
nction 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.valu

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 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@googlegroups.

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 that

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

2010-06-29 Thread j-g-faustus
Well, it gives a baseline to compare 1.2 improvements against. In terms of speed, convenience or readability. On Jun 28, 8:02 pm, Aaron Cohen wrote: > Doing these tests on clojure 1.1, while self-enlightening, is kind of > missing the point. -- You received this message because you are subscrib

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

2010-06-28 Thread j-g-faustus
efinterface 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 > wrote: > > > On profiling I have a bunch of intCast(Object) and doubleCast(double) > > totaling ~9%

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=nbody&lang=all The fastest code I've managed so far is here: http://github.com/j-g-faustu

Re: State of Clojure web development

2010-06-24 Thread j-g-faustus
> 1. Have you written, or are you writing, a web application that uses > Clojure? What does it do? Recently started writing a webapp to display financial data, along the lines of Google finance. Although somewhat less ambitious :). > 2. Which libraries or frameworks are you using? Which versions?

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 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 use:

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 ) => # Is this a Clojure bug? Or related to Enclojure on NetBeans? Or some sort of hidden feature in comments? Regards jf -- You received this message because you are subscribed to the Google Groups

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 tha

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

2010-05-13 Thread j-g-faustus
Hi, just started looking at Clojure, and it looks promising as a modern- day Lisp for practical use. I saw this presentation on Clojure: http://clojure.blip.tv/ and I wholeheartedly agree with the design principles. Unified access to all kinds of collections (list, array, struct, hash) is somethi