Re: Enhanced Primitive Support

2010-06-19 Thread Aaron Cohen
On Sat, Jun 19, 2010 at 11:22 PM, Mike Meyer wrote: > > "Rob Lachlan" wrote: > >>Actually, Mike, your two functions work just fine.  (Equal branch). >>Mind you I checked that out over two hours ago, so this information >>might be out of date. >> >>Rob >> >>On Jun 19, 6:59 pm, Mike Meyer > Ok, wh

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
"Rob Lachlan" wrote: >Because the compiler is upset that it doesn't know what n is. r is a >long, but n is ???. The following works: > >(defn ^:static fact [^long n] > (loop [n n r 1] >(if (zero? n) > r > (recur (dec n) (* r n) > >Or see Dnolen's version above. But yeah, I

Re: Enhanced Primitive Support

2010-06-19 Thread Rob Lachlan
Because the compiler is upset that it doesn't know what n is. r is a long, but n is ???. The following works: (defn ^:static fact [^long n] (loop [n n r 1] (if (zero? n) r (recur (dec n) (* r n) Or see Dnolen's version above. But yeah, I wish that it still worked, because

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
"Rob Lachlan" wrote: >Actually, Mike, your two functions work just fine. (Equal branch). >Mind you I checked that out over two hours ago, so this information >might be out of date. > >Rob > >On Jun 19, 6:59 pm, Mike Meyer > (defn count-in [value col] >>    (loop [value value col col res 0] >>  

Re: How to use Clojure with Robocode

2010-06-19 Thread nakkaya
This answer is couple months too late but I was messing with robocode this weekend, had the same problem OP had. The solution is to unzip clojure.jar into the folder where your compiled class files are. That makes the error go away but it will also increase robocode's boot time by 20-30 secs. Hope

Re: Enhanced Primitive Support

2010-06-19 Thread Rob Lachlan
I don't think my computer has enough memory to test that. But, you're right, I might have spoken hastily. Rob On Jun 19, 7:26 pm, Aaron Cohen wrote: > I actually believe it will throw an overflow exception if col contains > more than Integer.MAX_VALUE elements. Hard to confirm without getting >

Re: Enhanced Primitive Support

2010-06-19 Thread Aaron Cohen
I actually believe it will throw an overflow exception if col contains more than Integer.MAX_VALUE elements. Hard to confirm without getting bored though. -- Aaron On Sat, Jun 19, 2010 at 10:19 PM, Rob Lachlan wrote: > Actually, Mike, your two functions work just fine.  (Equal branch). > Mind yo

Re: Enhanced Primitive Support

2010-06-19 Thread Michał Marczyk
On 20 June 2010 03:59, Mike Meyer wrote: > So here's some new > examples, pulled in sequence from some of my combinatorics code: This works fine as far as arithmetic ops are concerned, though I suppose it might suffer from issues of = vs. == now (which is a separate matter). Sincerely, Michał -

Re: Enhanced Primitive Support

2010-06-19 Thread Rob Lachlan
Actually, Mike, your two functions work just fine. (Equal branch). Mind you I checked that out over two hours ago, so this information might be out of date. Rob On Jun 19, 6:59 pm, Mike Meyer wrote: > On Sat, 19 Jun 2010 20:40:13 -0400 > > David Nolen wrote: > > Mark and Mike you fail to addre

Re: Enhanced Primitive Support

2010-06-19 Thread Michał Marczyk
On 20 June 2010 02:13, David Nolen wrote: > On Sat, Jun 19, 2010 at 4:10 PM, Michał Marczyk > wrote: >> (defn fact [n] >>  (loop [n n r 1] >>    (if (zero? n) >>      r >>      (recur (dec n) (* r n) > Huh? That doesn't look like it's going to work at all. > 1) 1 is primitive, we know that, a

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 20:40:13 -0400 David Nolen wrote: > Mark and Mike you fail to address my deeper question. Maybe because you've failed to ask in your hurry to claim code is non-idiomatic or calling our example rhetoric. > I've been using > many different Clojure libraries all day long with t

Re: need help understanding two issues

2010-06-19 Thread Michał Marczyk
On 19 June 2010 18:59, Albert Cardona wrote: > 1. How come APersistentMap$KeySet doesn't implement IPersistentSet? Beyond what Rob has already written above, keys works with APersistentMap$KeySeq (note the "q" at the end), not APersistentMap$KeySet. To get at the latter, use (.keySet {:a 1 :b 2})

Re: Enhanced Primitive Support

2010-06-19 Thread David Nolen
Mark and Mike you fail to address my deeper question. I've been using many different Clojure libraries all day long with the latest equals branch. Guess what? No loop/recur bugs. When you guys start postIng your broken code that has this problem then people can start believing it is an issue for

Re: Enhanced Primitive Support

2010-06-19 Thread Rob Lachlan
The main example for recur on the special forms page (http:// clojure.org/special_forms#Special%20Forms--(recur%20exprs*)) is: (def factorial (fn [n] (loop [cnt n acc 1] (if (zero? cnt) acc (recur (dec cnt) (* acc cnt)) I may not be be clojure jedi, but I've

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 20:13:07 -0400 David Nolen wrote: > On Sat, Jun 19, 2010 at 4:10 PM, Michał Marczyk > wrote: > > (defn fact [n] > > (loop [n n r 1] > >(if (zero? n) > > r > > (recur (dec n) (* r n) > > Huh? That doesn't look like it's going to work at all. > > 1) 1 is pr

Re: Enhanced Primitive Support

2010-06-19 Thread Mark Engelberg
On Sat, Jun 19, 2010 at 5:13 PM, David Nolen wrote: > Huh? That doesn't look like it's going to work at all. > 1) 1 is primitive, we know that, accept it > 2) we don't know the type of n, what will (* r n) be? > 3) BOOM! Yes David, if you have a deep understanding of how loop/recur interacts with

Re: Enhanced Primitive Support

2010-06-19 Thread Peter Schuller
> Where can I get jar files of the various branches so I can test for > myself without having to deploy whatever infrastructure is needed to > build clojure these days? Or am I likely to be able to build them with > tools found in the BSD ports tree? It still seems to build with 'ant' like it alwa

Re: Enhanced Primitive Support

2010-06-19 Thread David Nolen
On Sat, Jun 19, 2010 at 4:10 PM, Michał Marczyk wrote: > (defn fact [n] > (loop [n n r 1] >(if (zero? n) > r > (recur (dec n) (* r n) Huh? That doesn't look like it's going to work at all. 1) 1 is primitive, we know that, accept it 2) we don't know the type of n, what will (*

Re: Enhanced Primitive Support

2010-06-19 Thread Mark Engelberg
On Sat, Jun 19, 2010 at 4:10 PM, Michał Marczyk wrote: > (defn fact [n] >  (loop [n n r 1] >    (if (zero? n) >      r >      (recur (dec n) (* r n) Thanks for posting this surprisingly simple example of something that looks like it should work, but wouldn't under the current proposal. Really

Re: Enhanced Primitive Support

2010-06-19 Thread Michał Marczyk
On 19 June 2010 23:51, Mike Meyer wrote: > In any case, I don't think 10% is enough gain to justify narrowing the > range for which naive programs are correct. An order of magnitude > would be. A factor of two is a maybe. QFT! Have a look at this: (defn fact [n] (loop [n n r 1] (if (zero?

Re: Enhanced Primitive Support

2010-06-19 Thread Michał Marczyk
On 19 June 2010 16:43, David Nolen wrote: > "Most real world programs". You mean like Clojure itself? > Please look over the implementation of gvec before making statements like > this: Surely Clojure's internals are a *very* special case though... I wouldn't find it particularly worrying if they

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 22:27:05 +0100 Nicolas Oury wrote: > On Sat, Jun 19, 2010 at 10:15 PM, Mike Meyer wrote: > > Pretty much any time I really need integer speed, I also deal with > > numbers that can get much larger than 10^19th, because I tend to be > > doing combinatorics or cryptography. > B

Re: Enhanced Primitive Support

2010-06-19 Thread Nicolas Oury
On Sat, Jun 19, 2010 at 10:15 PM, Mike Meyer wrote: > > > Pretty much any time I really need integer speed, I also deal with > numbers that can get much larger than 10^19th, because I tend to be > doing combinatorics or cryptography. > > But you would agree that for this kind of domain, it wouldn

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 20:20:48 +0100 Nicolas Oury wrote: > Not "ordinary" code. 10^19 is big. No, Aleph-2 is big. Any non-infinite number you can name in your lifetime is small ;-). Pretty much any time I really need integer speed, I also deal with numbers that can get much larger than 10^19th, b

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
While I generally favor correct over fast (worrying about fast before you're correct is a good sign that you're engaged in premature optimization), I'm still trying to figure out the tradeoffs here. Especially since most LISPs & other dynamic languages don't seem to run into this issue - or at leas

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 10:43:36 -0400 David Nolen wrote: > On Sat, Jun 19, 2010 at 5:13 AM, Mike Meyer < > mwm-keyword-googlegroups.620...@mired.org> wrote: > > > > > > Were those real world programs, or arithmetic benchmarks? Most real world > > programs I see spend so little of their time doing ar

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
On Sat, 19 Jun 2010 11:00:39 +0100 Nicolas Oury wrote: > There is a bit of arithmetic involved everywhere, and around 2-3 double > operations per function in the part choosing the instance of rule to apply. That still sounds arithmetic-heavy to me. In looking through my code, I find three differ

Re: Enhanced Primitive Support

2010-06-19 Thread Brian Goslinga
On Jun 19, 2:24 pm, Mark Engelberg wrote: > On Sat, Jun 19, 2010 at 12:20 PM, Nicolas Oury wrote: > > Not "ordinary" code. 10^19 is big. > > Nicolas, I think you misunderstand my point.  I'm talking about > loop/recur behavior.  If you initialize a loop with the literal 1, and > then recur with a

Re: Enhanced Primitive Support

2010-06-19 Thread Garth Sheldon-Coulson
Do any of the proposals on the table affect floating point math? Currently, it seems mildly inconsistent to me that Clojure's numeric operations are auto-promoting and arbitrary-precision for integers but not for floats unless you specifically request it with the M suffix. This probably matters on

Re: Enhanced Primitive Support

2010-06-19 Thread Mark Engelberg
On Sat, Jun 19, 2010 at 12:20 PM, Nicolas Oury wrote: > Not "ordinary" code. 10^19 is big. Nicolas, I think you misunderstand my point. I'm talking about loop/recur behavior. If you initialize a loop with the literal 1, and then recur with a number 2 that's pulled from a collection (and thus bo

Re: Enhanced Primitive Support

2010-06-19 Thread Jules
On Jun 19, 3:53 pm, Rich Hickey wrote: > On Jun 19, 2010, at 6:39 AM, Jules wrote: > > > > > > > I know nothing about the JVM, but I do know that on x86 you can handle > > fixnum -> bignum promotion fairly cheaply. You compile two versions of > > the code: one for bignums and one for fixnums. Afte

Re: Enhanced Primitive Support

2010-06-19 Thread Nicolas Oury
Not "ordinary" code. 10^19 is big. On Sat, Jun 19, 2010 at 8:08 PM, Mark Engelberg wrote: > > Agreed, but with a default of boxing, it is possible to write all code > without ever using an annotation -- it will just be a bit slower than > it could be. With a default of primitives, there is ordin

Re: Enhanced Primitive Support

2010-06-19 Thread Mark Engelberg
On Sat, Jun 19, 2010 at 6:32 AM, Rich Hickey wrote: > Really? It seems tedious to me.  Don't you get tired of saying int i = 42 in > Java, when you know full well the compiler knows 42 is an int? I do, and > Clojure is competing with languages that infer the right types without the > redundancy.

Re: Clojure script in the classpath

2010-06-19 Thread Paul Moore
On 19 June 2010 17:22, Chas Emerick wrote: > If you're just looking to run a script that happens to be on the classpath, > you can do so by prepending an '@' character to the classpath-relative path > to the script. > > So, if a directory foo is on your classpath, and a clojure file you'd like > t

Re: Clojure script in the classpath

2010-06-19 Thread Paul Moore
On 19 June 2010 07:24, rzeze...@gmail.com wrote: > On Jun 18, 6:15 pm, Paul Moore wrote: >> I've just seen a couple of postings which, if I'm not mistaken, imply >> that it's possible to have a Clojure script in my classspath. Is that >> right? > > Yes, you can have .clj files on your classpath.

Re: Basic toolset for non-Java programmer

2010-06-19 Thread Paul Moore
Thanks to Ryan, Rob and Alex for the suggestions. I'll have a deeper look into all of them. Paul -- 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 moderat

Re: Enhanced Primitive Support

2010-06-19 Thread Daniel
On Jun 19, 11:45 am, Rich Hickey wrote: > On Jun 19, 2010, at 4:25 AM, Daniel wrote: > > > > > Checked out the new prim branch to repeat some tests. > > > user=> (defn ^:static fib ^long [^long n] > > (if (<= n 1) > >1 > >(+ (fib (dec n)) (fib (- n 2) > > #'user/fib > > user=> (time (

Re: Enhanced Primitive Support

2010-06-19 Thread Rich Hickey
On Jun 19, 2010, at 1:05 PM, Tim Daly wrote: (proclaim (speed 3) (safety 0)) is verbose? Telling the compiler in one place that you care about boxing speed, such as (declare (x unboxed)) seems to me to be a very direct way to tell the compiler to choose +' vs + everywhere that 'x' occurs. Th

Re: need help understanding two issues

2010-06-19 Thread Rob Lachlan
I'll take a whack at it. > 1. How come APersistentMap$KeySet doesn't implement IPersistentSet? Because keys and vals are designed to return (lazy) sequences. More important, these two functions return those two sequences in the same order. The laziness avoids having to incur the overhead of cr

Re: Enhanced Primitive Support

2010-06-19 Thread Tim Daly
(proclaim (speed 3) (safety 0)) is verbose? Telling the compiler in one place that you care about boxing speed, such as (declare (x unboxed)) seems to me to be a very direct way to tell the compiler to choose +' vs + everywhere that 'x' occurs. This means that "it just works" code does not need

need help understanding two issues

2010-06-19 Thread Albert Cardona
Hi all, I have run into the following two issues over the last few days. I would appreciate insight/help/advice: 1. How come APersistentMap$KeySet doesn't implement IPersistentSet? (clojure.set/intersection (keys {2 "two" 4 "four"}) #{2 3}) java.lang.ClassCastException: clojure.lang.APersiste

Re: Enhanced Primitive Support

2010-06-19 Thread Rich Hickey
On Jun 19, 2010, at 4:25 AM, Daniel wrote: Checked out the new prim branch to repeat some tests. user=> (defn ^:static fib ^long [^long n] (if (<= n 1) 1 (+ (fib (dec n)) (fib (- n 2) #'user/fib user=> (time (fib 38)) "Elapsed time: 4383.127343 msecs" 63245986 That's certainly not

Re: labrepl isn't a project in netbeans 6.8 - (Ubuntu 10.04)

2010-06-19 Thread kredaxx
Find the Maven plugin in the NB's plugin section and install if you don't have it. It *might* help. At least that's what fixed it for my NB installation. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goog

Re: classpath and require

2010-06-19 Thread Mohammad Khan
Yes, exactly it was, also at some point I was trying examples/introduction (ruby's require like statement) instead of examples.introduction which all together made me lost. Thanks everybody for your help. Thanks, Mohammad On Sat, Jun 19, 2010 at 11:59 AM, Michael Wood wrote: > On 19 June 2010

Records forget they are records

2010-06-19 Thread Oscar Forero
Hello, I am working with Clojure for a university project and hit this problem http://paste.pocoo.org/show/227239/ I am trying to defines symbols from a map with keywords as keys and X as value (where X is usually a lambda or a Record), the first example does that ... (binder data) Creates the

Re: Enhanced Primitive Support

2010-06-19 Thread Daniel
Checked out the new prim branch to repeat some tests. user=> (defn ^:static fib ^long [^long n] (if (<= n 1) 1 (+ (fib (dec n)) (fib (- n 2) #'user/fib user=> (time (fib 38)) "Elapsed time: 4383.127343 msecs" 63245986 That's certainly not what I expected user=> (defn fact [n]

Re: classpath and require

2010-06-19 Thread Mohammad Khan
Correction, it worked.. On Fri, Jun 18, 2010 at 6:19 PM, Mohammad Khan wrote: > No, it didn't work.. what else I could be missing.. > > > On Fri, Jun 18, 2010 at 5:56 PM, Rob Lachlan wrote: > >> Whoops, that should read: >> >> java -cp c:\clojure-contrib\clojure-contrib.jar;c:\clojure >> \cloju

Re: Clojure script in the classpath

2010-06-19 Thread Chas Emerick
If you're just looking to run a script that happens to be on the classpath, you can do so by prepending an '@' character to the classpath-relative path to the script. So, if a directory foo is on your classpath, and a clojure file you'd like to run is at foo/bar/script.clj, then you can run

Re: classpath and require

2010-06-19 Thread Michael Wood
On 19 June 2010 17:46, Rob Lachlan wrote: > I was wondering whether putting a dot in a directory on the classpath > makes a difference.  On OS X, the answer is no.  Unfortunately, I > don't have a windows machine, so I can't check for certain what the > situation is there. No, rzezeski found the

Re: Enhanced Primitive Support

2010-06-19 Thread Rich Hickey
The hard error has been restored: http://github.com/richhickey/clojure/commit/25165a9ccd1001fa7c4725a8219c4108803ae834 Rich On Jun 19, 2010, at 2:03 AM, Mark Engelberg wrote: I'm confused. In the latest scheme, what is the eventual plan for handling a recur to a loop element that was initial

Re: classpath and require

2010-06-19 Thread Rob Lachlan
I was wondering whether putting a dot in a directory on the classpath makes a difference. On OS X, the answer is no. Unfortunately, I don't have a windows machine, so I can't check for certain what the situation is there. Another issue: I ignored case-sensitivity in my answer above. Are windows

what replaces clojure.parallel?

2010-06-19 Thread Albert Cardona
Hi all, The http://clojure.org/other_libraries web page states that: "Parallel Processing" "The parallel library (namespace parallel, in parallel.clj) wraps the ForkJoin library. This lib is now deprecated." If the clojure.parallel is deprecated, what replaces it? Is it pcalls and pvalues in clo

Re: Enhanced Primitive Support

2010-06-19 Thread Nicolas Oury
I definitely would like to see more people trying their code with primitive by default and talk about unexpected bugs and performance improvements. On Sat, Jun 19, 2010 at 3:43 PM, David Nolen wrote: > > "Most real world programs". You mean like Clojure itself? > -- You received this message

Re: labrepl isn't a project in netbeans 6.8 - (Ubuntu 10.04)

2010-06-19 Thread Aaron Bedra
Jared, There was another post about issues with netbeans. I am looking into why this is happening. On another note, labrepl uses clojure 1.2, but that is all handled via leiningen. Cheers, Aaron On Thu, Jun 17, 2010 at 11:10 PM, Jared wrote: > I was following the instructions to get labrepl

Re: Enhanced Primitive Support

2010-06-19 Thread David Nolen
On Sat, Jun 19, 2010 at 5:13 AM, Mike Meyer < mwm-keyword-googlegroups.620...@mired.org> wrote: > > > Were those real world programs, or arithmetic benchmarks? Most real world > programs I see spend so little of their time doing arithmetic that making > the math an order of magnitude slower wouldn'

Re: Enhanced Primitive Support

2010-06-19 Thread cageface
Maybe it's only because I'm coming from Ruby, in which number promotion is automatic and everything is slow, but if I have to choose between correctness and performance as a *default*, I'll choose correctness every time. I think there's a good reason that GCC, for instance, makes you push the compi

Re: Enhanced Primitive Support

2010-06-19 Thread Rich Hickey
On Jun 19, 2010, at 6:41 AM, Heinz N. Gies wrote: On Jun 19, 2010, at 4:12 , Rich Hickey wrote: I have to say I'm in the 'pay for what you use' camp - you need a box, you ask for one. If I don't (and neither do any of those loops), why should I have to do extra work to avoid it? - 42 I

Re: Enhanced Primitive Support

2010-06-19 Thread Rich Hickey
On Jun 19, 2010, at 6:39 AM, Jules wrote: I know nothing about the JVM, but I do know that on x86 you can handle fixnum -> bignum promotion fairly cheaply. You compile two versions of the code: one for bignums and one for fixnums. After an arithmetic instruction in the fixnum code you check if

Re: Enhanced Primitive Support

2010-06-19 Thread Rich Hickey
On Jun 19, 2010, at 2:50 AM, Tim Daly wrote: Is it possible to follow the Common Lisp convention of proclaim/declaim/declare in order to specify types? It would be possible of course, but undesirable. We're trying to avoid that kind of verbosity. Rich -- You received this message becaus

Re: Enhanced Primitive Support

2010-06-19 Thread Rich Hickey
On Jun 19, 2010, at 2:03 AM, Mark Engelberg wrote: I'm confused. In the latest scheme, what is the eventual plan for handling a recur to a loop element that was initialized with a primitive? Are boxed numbers automatically coerced to the primitive? Would a long be coerced to a double, or doub

Re: Enhanced Primitive Support

2010-06-19 Thread Heinz N. Gies
On Jun 19, 2010, at 14:55 , Rich Hickey wrote: > > Yes, that's a bit Java-ish. All we care about here is returning the canonic > boxed representation of the number. It was suggested before that it is simple to allow automatic promotion, by compiling multiple versions. how about doing this? On

Re: Enhanced Primitive Support

2010-06-19 Thread Rich Hickey
On Jun 18, 2010, at 11:47 PM, dmiller wrote: Yes, it's easy to imagine a world where people who want efficient code have to jump through hoops to get it. OTOH, you can just say (num some- expr) to force it to be boxed, if you want assurance of an Object initializer. Which will be the more c

Re: Enhanced Primitive Support

2010-06-19 Thread David Powell
> I think if we had them, promoting ops > should be the primed ones, and they would mostly be used in library Oops, I had meant the non-primed ops should support promotion. But tbh, I have mixed feelings about promotion. I haven't required bitint promotion myself, but having statically typed num

Re: Enhanced Primitive Support

2010-06-19 Thread Heinz N. Gies
On Jun 19, 2010, at 14:18 , David Powell wrote: > > (loop [^int n 1 r 1](if (zero? n) r (recur (dec n) (* r 0.2 > > > Numeric literals would still produce primitives where possible, but > would get auto-boxed in loop initialisers. > > I think this option wouldn't have any nasty surprises.

Re: Enhanced Primitive Support

2010-06-19 Thread David Powell
Personally, I have no real interest in bigints, but I'm glad that they are there, and that arithmetic code supports them polymorphically. I'm not sure what I think regarding non-promoting numeric operators. They are ok, but they seem to add complexity to the language, and they don't look very ne

Re: Problems with URL params and http-agent

2010-06-19 Thread Michael Wood
On 18 June 2010 23:54, Timothy Washington wrote: > That works, thanks. It's a bit weird because I did try just http encoding > the parameters before. But I obviously encoded the wrong characters, or > maybe used the wrong character encoding. Hmmm. > > Thanks :) No problem :) -- Michael Wood -

Re: Enhanced Primitive Support

2010-06-19 Thread Michał Marczyk
On 19 June 2010 03:33, Rich Hickey wrote: > Turnabout is fair play, so I've produced a version that swaps the > defaults, still in the 'equal' branch: The issue of which behaviour should be the default aside, I think that I'd expect the *, + etc. ops to go with unannotated literals and the primed

Re: scala

2010-06-19 Thread nickikt
For such a young language it has a big momentum. Did Scala have that after 2 years? On 18 Jun., 23:56, cageface wrote: > Quick disclaimer - there are a lot of things I like in Scala and I > think Odersky & crew have done some very impressive work bringing > functional language concepts to the VM

Re: Enhanced Primitive Support

2010-06-19 Thread Heinz N. Gies
On Jun 19, 2010, at 4:12 , Rich Hickey wrote: > I have to say I'm in the 'pay for what you use' camp - you need a box, you > ask for one. If I don't (and neither do any of those loops), why should I > have to do extra work to avoid it? - 42 I totally and wholeheartedly disagree, as long as the

Re: Enhanced Primitive Support

2010-06-19 Thread Jules
I know nothing about the JVM, but I do know that on x86 you can handle fixnum -> bignum promotion fairly cheaply. You compile two versions of the code: one for bignums and one for fixnums. After an arithmetic instruction in the fixnum code you check if it overflowed, and if it did you switch to the

Re: Enhanced Primitive Support

2010-06-19 Thread Nicolas Oury
yes, when it will be released :-b. I can describe it though: it applied a stochastically a set of rewriting rules on trees (represented by records of records). To speed up, the activity of the rules in each subtree is cached in a Java weak hash table from one step to another. There is a bit of ar

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
"Nicolas Oury" wrote: >I tried it on my program. Very few arithmetic, most of it with annotation. >10% Can we see the source? -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- You received this message because you are subscribed to the Google Groups "Clojure" group. T

Re: Enhanced Primitive Support

2010-06-19 Thread Nicolas Oury
I tried it on my program. Very few arithmetic, most of it with annotation. 10%. On an arithmetic benchmark, it would be in te *10/*20 range. This 10% is orthogonal to what profiling shows. It just makes a lot of little improvements spread everywhere. That's why it couldn't be solved with annotation

Re: Enhanced Primitive Support

2010-06-19 Thread Mike Meyer
"Nicolas Oury" wrote: >On the other hand, having boxed by default is a very significant slowdown >(10% on the strange program I tried, that had already a lot of annotations, >probably 20% or more on most programs), that can never be addressed : you >can't write annotations on every single line o

Re: classpath and require

2010-06-19 Thread Rasmus Svensson
2010/6/18 Mohammad Khan > C:\Projects.clj>java -cp > c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar clojure.main > Clojure 1.1.0-alpha-SNAPSHOT > user=> (require 'examples.introduction) > java.io.FileNotFoundException: Could not locate > examples/introduction__init.class or example

Re: compiling the instructions of a simple vm into a function

2010-06-19 Thread Nicolas Oury
There is two way to make a domain-specific language with a clojure back-end : - if you want the language to be an extension of Clojure, still to be used in a REPL or by clojure source -> you write macros. That's what I call embedded. There is a lot of litterature on Embedded Domain Specific

Re: Basic toolset for non-Java programmer

2010-06-19 Thread Alex Ott
Hello Paul Moore at "Sat, 19 Jun 2010 00:08:54 +0100" wrote: PM> - Build tools: There seem to be things like ant, maven, leiningen. How PM> do they relate to each other? Is there an "obvious" best answer or PM> should I be expecting to check them all out depending on my needs? In PM> that cas

Re: Enhanced Primitive Support

2010-06-19 Thread Nicolas Oury
On Sat, Jun 19, 2010 at 3:12 AM, Rich Hickey wrote: > > I have to say I'm in the 'pay for what you use' camp - you need a box, you > ask for one. If I don't (and neither do any of those loops), why should I > have to do extra work to avoid it? > > Rich > > > +1. It is often very easy to spot int

Re: Enhanced Primitive Support

2010-06-19 Thread Konrad Hinsen
On 18.06.2010, at 15:31, Nicolas Oury wrote: > In this situation, I would rather have some kind of toggle > *use-bigints-by-default* (defaulted to false) used by the compiler. > Then, if someone needs big integers, he can switch the toggle and recompile > everything. > You wouldn't have to chang

Re: Clojure / Common Lisp Question

2010-06-19 Thread Tim Daly
Clojure is an amazing piece of work. I'm interested in Clojure for the concurrency. I'm also interested in the immutable data structure work. Someone needs to write a paper about the performance characteristics of immutable structures when the whole structure changes. That is, what are the perfo

Re: Enhanced Primitive Support

2010-06-19 Thread Konrad Hinsen
On 18.06.2010, at 15:20, Rich Hickey wrote: > Which then begs the questions: > > - how will someone 'protect' themselves from libraries written using fastmath? Using fastmath or not would be part of the library specification. Or, in general, of the documentation for each individual function. It