Re: Leiningen 1.3.0 - compile task problem

2010-08-26 Thread Phil Hagelberg
On Thu, Aug 26, 2010 at 5:59 PM, wrote: > Instead I decided to experiment a Leiningen plug in, sauberjar to create the > target only with the class files and only the ones for which there is a > corresponding source file in the source folder. To start this asap, I cloned > the > existing jar tas

Re: inserting into vector

2010-08-26 Thread meb
(defn insert [v at el] (flatten (assoc v at [el (v at)])) You get a lazy seq back, so further operations are probably not as performant as they should be. But that would be as performant as a regular assoc for just that one operation. What you do from then on. Mark On Aug 26, 10:33 am, C

Re: Leiningen 1.3.0 - compile task problem

2010-08-26 Thread lprefontaine
I read the ticket on Assembla and found it risky to try to implement the patch. Instead I decided to experiment a Leiningen plug in, sauberjar to create the target only with the class files and only the ones for which there is a corresponding source file in the source folder. To start this asap,

Re: bug?? extend Object compilation order dependency?

2010-08-26 Thread DeverLite
Thank you Stuart. All the years of thinking about functions as being subservient to objects has warped my brain. I believe I've read about this inversion for protocols before but I don't think I've really grasped all the consequences of it until now. What I'm taking away from this is that it is pr

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-08-26 Thread Isaac Gouy
On Aug 26, 8:37 am, John Fingerhut wrote: > I have now submitted small modifications that permit AOT compilation.  The > compile time was small -- on the order of 1 to 2 sec of the total CPU time, > which is often a small percentage of the long runs that are reported on the > shootout web site.

Re: bug?? extend Object compilation order dependency?

2010-08-26 Thread Stuart Halloway
Redefining Foo gives you a new implementation of bar, which, like any protocol method, will fail for all inputs until a type has been extended to it. > I ran your sequence without redefining Foo and got 20 instead of 1/5. > I don't know how that redefinition affects the evaluation of bar. > > Cl

Looking for feedback: Deploying a Clojure App

2010-08-26 Thread Kyle R. Burton
http://news.ycombinator.com/item?id=1636515 Or Direct link: http://asymmetrical-view.com/2010/08/26/how-were-deploying-our-clojure-applications.html I thought others might find reading this valuable, I'm sure there are other ways to do this, it's working for me for now. Regards, Kyle --

Re: bug?? extend Object compilation order dependency?

2010-08-26 Thread Stuart Halloway
The problem here is that you are presuming that a protocol function "bar" is a behavior of the types it is extended to. Invert that: "bar" is its own function, and the types come to it, not the other way around. If you explicitly replace "bar" with a new function (which redeclaring the protocol

Re: inserting into vector

2010-08-26 Thread Chouser
On Thu, Aug 26, 2010 at 12:43 PM, David Nolen wrote: > On Thu, Aug 26, 2010 at 11:53 AM, Chouser wrote: >> >> On Thu, Aug 26, 2010 at 9:44 AM, Jon Seltzer >> wrote: >> > I know what assoc does: >> > >> > user=> (assoc [\a \b \c] 0 \d)  ;please extend to much larger vector >> > with index somewhe

Re: Some clarifications about let form

2010-08-26 Thread nickikt
Its for defining look variables (constants) that you use more then once in your form and not have to write it more then once (or calculated it more then once) (let [r1 (random-int) r2 (random-int)] (when (the-same? r1 r2) (str r1 " and " r2 " are the same")) Write

Re: bug?? extend Object compilation order dependency?

2010-08-26 Thread Stuart Halloway
> I may have misunderstood what I've read about protocols, so please set > me straight if the following is wrong - > > On Aug 25, 11:08 pm, Stuart Halloway > wrote: >> I think the current behavior follows the principle of least surprise: >> >> (1) bar is a function, in whatever namespace the pro

Re: bug?? extend Object compilation order dependency?

2010-08-26 Thread Grayswx
Someone correct me if I'm wrong, but I think what's happening is that when you call (defprotocol Foo ...) for the second time, you're setting the symbol Foo to point to the new protocol, while the original fooed still has the old protocol. It also binds bar to a completely new function, which has

Re: bug?? extend Object compilation order dependency?

2010-08-26 Thread DeverLite
My understanding is that old (previously constructed) instances of a record follow the old implementation. To get the new behavior after recompiling a record you must construct a new instance. On Aug 26, 10:51 am, Armando Blancas wrote: > I ran your sequence without redefining Foo and got 20 inst

Re: bug?? extend Object compilation order dependency?

2010-08-26 Thread DeverLite
Perhaps I should have explained why I think 20 should be the right answer. This is based on my expectation that once I've compiled a file the behavior of records or types defined in that file will not change (unless I re-bind functions called by the record or type). The above behavior violates thi

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-08-26 Thread John Fingerhut
I have now submitted small modifications that permit AOT compilation. The compile time was small -- on the order of 1 to 2 sec of the total CPU time, which is often a small percentage of the long runs that are reported on the shootout web site. But of course it is better if it is not included in

Re: inserting into vector

2010-08-26 Thread David Nolen
On Thu, Aug 26, 2010 at 11:53 AM, Chouser wrote: > On Thu, Aug 26, 2010 at 9:44 AM, Jon Seltzer > wrote: > > I know what assoc does: > > > > user=> (assoc [\a \b \c] 0 \d) ;please extend to much larger vector > > with index somewhere in the middle > > [\d \b \c] > > > > but what if I want: > >

Re: Does Clojure has a compiler

2010-08-26 Thread Tom Faulhaber
As the other posters mention, Clojure does have a compiler. However, you don't always need to use it explicitly. Clojure will compile all input before executing it and once it's compiled it runs with the exact performance it would if it had been compiled ahead of time. There's no interpreted laye

Re: inserting into vector

2010-08-26 Thread Chouser
On Thu, Aug 26, 2010 at 11:53 AM, Chouser wrote: > On Thu, Aug 26, 2010 at 9:44 AM, Jon Seltzer wrote: >> I know what assoc does: >> >> user=> (assoc [\a \b \c] 0 \d)  ;please extend to much larger vector >> with index somewhere in the middle >> [\d \b \c] >> >> but what if I want: >> >> user=> (

Re: inserting into vector

2010-08-26 Thread Chouser
On Thu, Aug 26, 2010 at 9:44 AM, Jon Seltzer wrote: > I know what assoc does: > > user=> (assoc [\a \b \c] 0 \d)  ;please extend to much larger vector > with index somewhere in the middle > [\d \b \c] > > but what if I want: > > user=> (assoc-x [\a \b \c] 0 \d)  ;is there an assoc-x > [\a \d \b \c

Re: bug?? extend Object compilation order dependency?

2010-08-26 Thread Armando Blancas
I ran your sequence without redefining Foo and got 20 instead of 1/5. I don't know how that redefinition affects the evaluation of bar. Clojure 1.2.0 user=> (defprotocol Foo (bar [this x])) Foo user=> (defrecord fooed [] Foo (bar [this x] (* 2 x))) user.fooed user=> (extend-type Object Foo (bar [t

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-08-26 Thread Isaac Gouy
On Aug 26, 12:26 am, Meikel Brandmeyer wrote: > Hi, > > On 26 Aug., 07:58, Isaac Gouy wrote: > > > Have you actually measured the time difference? If you have measured the time difference with/without AOT compilation then apparently you don't wish to share those measurements. Oh well. Witho

inserting into vector

2010-08-26 Thread Jon Seltzer
I know what assoc does: user=> (assoc [\a \b \c] 0 \d) ;please extend to much larger vector with index somewhere in the middle [\d \b \c] but what if I want: user=> (assoc-x [\a \b \c] 0 \d) ;is there an assoc-x [\a \d \b \c] I don't see a function that does this. I'm sure I'm missing it. I

native-deps 1.0.3 (fixes for lein 1.3.0)

2010-08-26 Thread David Nolen
I'm posting here because it seems more people rely on this lein plugin than I had thought. I've patched native-deps to work with lein 1.3.0 but haven't yet pushed to Clojars which I'll do later today. In the meantime you can clone the repo, http://github.com/swannodette/native-deps, and run the fol

Re: Some clarifications about let form

2010-08-26 Thread Meikel Brandmeyer
Hi, On 26 Aug., 17:02, HB wrote: > Hey, > Basically, I understand what let form does but I'm not sure when to > use it. > Would you please enlighten me about it? (if possible some typical Java > code and then covert it to Clojure let form). > I really appreciate your time and help. > Thanks. Str

Some clarifications about let form

2010-08-26 Thread HB
Hey, Basically, I understand what let form does but I'm not sure when to use it. Would you please enlighten me about it? (if possible some typical Java code and then covert it to Clojure let form). I really appreciate your time and help. Thanks. -- You received this message because you are subscr

Re: No (doc print-dup)?

2010-08-26 Thread Stephen C. Gilardi
On Aug 26, 2010, at 8:07 AM, Jacek Laskowski wrote: > Hi, > > Right in the middle of Clojure and Rails - the Secret Sauce Behind > FlightCaster [1] I came across print-dup function. I thought I'd find > out a bit more about it using (doc print-dup) which eventually > yielded: > > devmac:~ jacek

Re: Leiningen 1.3.0 - compile task problem

2010-08-26 Thread lprefontaine
Thank you Phil, I will give it a try today. If it does not work I'll filter the resulting jar files to retain only our name spaces. I'll come back with the status later today. Luc P. Phil Hagelberg wrote .. > On Wed, Aug 25, 2010 at 5:59 PM, wrote: > > We are completing the migration to cloj

Possible to avoid reflection warning in this case for bit-shift-left/right in 1.2?

2010-08-26 Thread Andy Fingerhut
Greetings: I am trying to use bit-shift-left and/or bit-shift-right with the first arg being a number that is larger than 32 bits, so it cannot be an int, and the second arg must be a variable, not a constant, e.g. (set! *warn-on-reflection* true) (defn my-left-shift [a-is-bigger-than-int b-is-r

Re: bug?? extend Object compilation order dependency?

2010-08-26 Thread MikeM
I may have misunderstood what I've read about protocols, so please set me straight if the following is wrong - On Aug 25, 11:08 pm, Stuart Halloway wrote: > I think the current behavior follows the principle of least surprise: > > (1) bar is a function, in whatever namespace the protocol Foo is d

No (doc print-dup)?

2010-08-26 Thread Jacek Laskowski
Hi, Right in the middle of Clojure and Rails - the Secret Sauce Behind FlightCaster [1] I came across print-dup function. I thought I'd find out a bit more about it using (doc print-dup) which eventually yielded: devmac:~ jacek$ clj Clojure 1.2.0 user=> (doc print-dup) - c

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-08-26 Thread Meikel Brandmeyer
Hi, On 26 Aug., 07:58, Isaac Gouy wrote: > Have you actually measured the time difference? Compare the mandelbrot numbers for Haskell, Java and Scala. The ranges are (0.07s 0.86s 13s), (0.19s 0.86s 12s), (0.22s 0.97s 15s). So Java and Scala are not slower than Haskell, but the low iteration num