Re: transient/persistent! not worth for less than 7-8 operations

2012-11-09 Thread Jim - FooBar();
No I'm on Ubuntu 12.04 64bit, oracle-java 7, clojure 1.4... Jim On 09/11/12 03:36, Herwig Hochleitner wrote: Hmm, this is the second (unverified) report of transients being slower than persistents. Jim, are you on OSX too, by chance? Which JVM? -- You received this message because you are

Re: Polymorphism based on predicates instead of dispatch value types

2012-11-09 Thread Matt Ridsdale
Thanks for the pointer, I haven't seen it and I'll be sure to give it a look when I have some time. Matt On Thursday, November 8, 2012 11:29:12 AM UTC+1, Philip Potter wrote: Have you seen David Nolen's conj 2011 talk, Predicate Dispatch? It covers exactly this material, but looks at trying

Re: transient/persistent! not worth for less than 7-8 operations

2012-11-09 Thread Softaddicts
Ubuntu 12.04, java 6 32 bits Luc P. This is weird...for just 2 operations I'm getting consistently better timings with persistent than transients... user= (time (dotimes [_ 100] (assoc [1 2 3 4 5 6 7 8 9 0] 3 5 6 8))) Elapsed time: 240.247405 msecs nil user= user= (time

is it possible to run `lein repl` without generating a `repl-port` file?

2012-11-09 Thread Satoru Logic
Hi, all. I notice that in every directory that I have runed `lein repl`, a file named `repl-port`is generated. I wonder if it's possible to set things up so that this file is not generated, or maybe I can set up some directory for these files. -- You received this message because you are

[ANN] ClojureScript release 0.0-1535 with G.Closure 0.0-2029

2012-11-09 Thread Stuart Sierra
ClojureScript release 0.0-1535 is out. Get it in Leiningen: [org.clojure/clojurescript 0.0-1535] Change log for this release: http://build.clojure.org/job/clojurescript-release/19/ This release depends on the latest version of the Google Closure Library, r2029. You can also depend on it

Re: [ANN] new book: ClojureScript: Up and Running

2012-11-09 Thread Stuart Sierra
On Thursday, November 8, 2012 4:14:03 PM UTC-5, Robert Pitts wrote: Awesome. Would you say that this is essentially a completed work? Growing weary or reading and re-reading beta books lately. Yes, the book is finished and out of beta. There may still be periodic updates and bug fixes to

Re: transient/persistent! not worth for less than 7-8 operations

2012-11-09 Thread Cedric Greevey
It stands to reason that transients won't help given a small number of operations. Consider a simplified model where conversion to transient and, eventually, back to persistent takes a constant number of cycles T and every operation on a transient takes exactly d cycles less than the corresponding

Re: transient/persistent! not worth for less than 7-8 operations

2012-11-09 Thread Jim foo.bar
exactly the point I was trying to make! However, other peoples' experiment seem not to agree with that! Jim On 09/11/12 15:09, Cedric Greevey wrote: In the real world, it's more complicated than that, and N could end up not only depending on which transient operations and on vector vs. map

Re: transient/persistent! not worth for less than 7-8 operations

2012-11-09 Thread Cedric Greevey
N could equal 1 under circumstances that make T small enough or d large enough. T might be small for a tiny collection, or d large for a large collection. Access pattern might matter, too. If a particular sequence of inserts causes a lot of worst-case tree rotations or something, say, maybe it

Re: Coding Standard - ns usage

2012-11-09 Thread Sean Corfield
On Thu, Nov 8, 2012 at 3:19 PM, Softaddicts lprefonta...@softaddicts.ca wrote: Oh, I must say that I rarely use the Eclipse debugger. Tracing does most of the job. Removing use would force us to redefine it somehow. (:use clojure.tools.trace) = (:require [clojure.tools.trace :refer :all) --

Re: Coding Standard - ns usage

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 8:28 AM, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Nov 8, 2012 at 3:19 PM, Softaddicts lprefonta...@softaddicts.ca wrote: Removing use would force us to redefine it somehow. (:use clojure.tools.trace) = (:require [clojure.tools.trace :refer :all) *sigh* no

Re: Slow image convolution

2012-11-09 Thread Andy Fingerhut
I haven't determined exactly why that particular code is slow for you, but I have looked at it for a few minutes and have some suggestions: 1. In Clojure 1.3 and later, the default integer type for primitive arithmetic is long, not int. Declaring things int means that they are really longs in

Re: [ANN] ClojureScript release 0.0-1535 with G.Closure 0.0-2029

2012-11-09 Thread Sean Corfield
Nice! I wonder how quickly lein-cljsbuild will get updated for this new release? (Evan?) Nice to see Leiningen and lein-cljsbuild introduced up front in your book as the quickest way to get up and running, Stuart! Sean On Fri, Nov 9, 2012 at 6:17 AM, Stuart Sierra the.stuart.sie...@gmail.com

Re: Slow image convolution

2012-11-09 Thread Yakovlev Roman
what a mess if it is a function it's huuge did you try split it to useful chunks ? it's just unreadable and that's why you cann't spot anything i guess.. пятница, 9 ноября 2012 г., 0:48:20 UTC+4 пользователь Cedric Greevey написал: I have the following code to perform a complicated image

Re: Slow image convolution

2012-11-09 Thread Andy Fingerhut
Having worked on Clojure benchmarks on the Computer Language Benchmarks Game web site, that is sometimes the kind of Clojure code one needs to write if you want it to be as fast as it can be. http://shootout.alioth.debian.org/u64q/compare.php?lang=clojure Also, splitting it out into

Re: Slow image convolution

2012-11-09 Thread Jim foo.bar
I thought 'definline' addresses exactly that...cases where one might want to pull out small pieces of first class functionality without sacrificing performance and without macros (which are not first-class)...am I mistaken? Jim ps: the only similarly big function that I've ever written

does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread larry google groups
Sorry this is such an ignorant question, but I am new to Clojure and the JVM. I am tring to find info about clojure.java.jdbc so I looked here: http://corfield.org/blog/post.cfm/connecting-clojure-and-mysql and saw this example: (ns mysql.core (:require [clojure.java.jdbc :as sql])) (def

Re: [ANN] new book: ClojureScript: Up and Running

2012-11-09 Thread Ravindra Jaju
I see you guys have kept that margin for updates/fixes already. The copyright notice talks about the year 2013. :) Copyright © 2013 Stuart Sierra, Luke VanderHart. Anyway, looking forward to spending some time with the book! -- jaju On Fri, Nov 9, 2012 at 7:49 PM, Stuart Sierra

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 9:42 AM, larry google groups lawrencecloj...@gmail.com wrote: Can I assume that sql/with-connection does some magic in the background to manage the connection? I would not want the connection to get shut down, and then restarted, everytime I run a query. Use a connection

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Jim foo.bar
the general idiom with-some-resource means that resources will be cleared after leaving its scope. JUst like with 'with-open' which has a try/finally in order to .close() any closable resource upon exit. I've not used clojure.java.jdbc but I suspect the same rationale applies for

Re: Coding Standard - ns usage

2012-11-09 Thread Softaddicts
Yep but still longer to type :) we are in the process of shrinking the code base, nit expanding it, any bytes count :)) On Fri, Nov 9, 2012 at 8:28 AM, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Nov 8, 2012 at 3:19 PM, Softaddicts lprefonta...@softaddicts.ca wrote: Removing use

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread larry google groups
Thank you. Again, apologies for the ignorant questions. I'm reading over this: http://clojure.github.com/java.jdbc/ If I read this correctly, once I have the db connection, I can use a combination of prepare-statement and do-prepared to run the select statements that i need to make?

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
I'm not sure why you'd need to use those low-level APIs for normal queries etc? Perhaps you can explain a bit more about what you're trying to do. Have you looked at this page: http://clojure.github.com/java.jdbc/doc/clojure/java/jdbc/UsingSQL.html Sean On Fri, Nov 9, 2012 at 10:13 AM, larry

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread larry google groups
I am looking here: http://clojure.github.com/java.jdbc/ I notice this: do-commands Usage: (do-commands commands) Executes SQL commands on the open database connection. This seems flexible, but how does it know what the open database connection is? I have to switch between 2 databases.

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread larry google groups
the general idiom with-some-resource means that resources will be cleared after leaving its scope. JUst like with 'with-open' which has a try/finally in order to .close() any closable resource upon exit. I've not used clojure.java.jdbc but I suspect the same rationale applies for

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 10:19 AM, larry google groups lawrencecloj...@gmail.com wrote: Usage: (do-commands commands) This seems flexible, but how does it know what the open database connection is? I have to switch between 2 databases. do-commands is intended for DDL. All of these API methods

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread larry google groups
do-commands is intended for DDL. All of these API methods are intended to be used inside (with-connection ...) which is how they know which DB connection to use. Again: Perhaps you can explain a bit more about what you're trying to do. Have you looked at this page:

Clojure Signal Processing

2012-11-09 Thread Stephen Olsen
Hey all, I've been thinking about and wanting to do some music transcription projects recently (inferring musical notes from audio) and what the best way to write systems like this is clojure would be. There are java libraries and things like fftw that can handle the *hard* parts like

Re: does clojure.java.jdbc/with-connection db keep the connection alive?

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 3:17 PM, larry google groups lawrencecloj...@gmail.com wrote: http://clojure.github.com/java.jdbc/doc/clojure/java/jdbc/UsingSQL.html I will read over that page. I have no experience with Java, which would probably help as there seem to be an abundance of Java examples

Can anyone explain this behavior of clojure.java.shell/sh ?

2012-11-09 Thread Andy Fingerhut
This issue may be specific to Linux, or even to a particular version of Linux that I am using (Ubuntu 11.10 32-bit desktop), although I doubt it is. If others try this out, I'd be curious to know what your results are, especially if you know why it is happening, and how it can be fixed.

Re: is it possible to run `lein repl` without generating a `repl-port` file?

2012-11-09 Thread Phil Hagelberg
This is a bug that's been fixed on master. A new release is just around the corner. -Phil -- 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 members are moderated -

Re: Can anyone explain this behavior of clojure.java.shell/sh ?

2012-11-09 Thread Ravindra Jaju
Don't have access right now to check, but guessing that xdg-open waits for the child process to exit. Try detaching/backgrounding? Not sure how you'd do that with the sh function though. Naively, wrap in (future ...)? -- jaju On Sat, Nov 10, 2012 at 6:56 AM, Andy Fingerhut

Re: is it possible to run `lein repl` without generating a `repl-port` file?

2012-11-09 Thread Satoru Logic
Cool! Thanks. On Saturday, November 10, 2012 10:20:14 AM UTC+8, Phil Hagelberg wrote: This is a bug that's been fixed on master. A new release is just around the corner. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

EOFException when using clojuredocs under repl

2012-11-09 Thread Satoru Logic
HI, all. I read in a `leiningen` tutorial that we can use `clojuredocs` to get docs and examples. But when I try, it failed with an `EOFException`: user= (clojuredocs pprint) EOFException Unexpected end of ZLIB input stream java.util.zip.InflaterInputStream.fill

Re: EOFException when using clojuredocs under repl

2012-11-09 Thread Sean Corfield
On Fri, Nov 9, 2012 at 8:50 PM, Satoru Logic satorulo...@gmail.com wrote: But when I try, it failed with an `EOFException`: user= (clojuredocs pprint) EOFException Unexpected end of ZLIB input stream java.util.zip.InflaterInputStream.fill (InflaterInputStream.java:223) Is this a bug?

Re: Can anyone explain this behavior of clojure.java.shell/sh ?

2012-11-09 Thread Michael Gardner
I can't duplicate your results on my Debian wheezy box (Clojure 1.4, openjdk 1.6.0_24, xdg-open 1.1.0 rc1); the call to (sh xdg-open …) returns immediately. The only possibilities I can think of are that your version of xdg-open blocks when run from a non-interactive shell, or that your version

Re: EOFException when using clojuredocs under repl

2012-11-09 Thread Satoru Logic
On Saturday, November 10, 2012 1:34:20 PM UTC+8, Sean Corfield wrote: On Fri, Nov 9, 2012 at 8:50 PM, Satoru Logic sator...@gmail.comjavascript: wrote: But when I try, it failed with an `EOFException`: user= (clojuredocs pprint) EOFException Unexpected end of ZLIB input