Re: Enhanced Primitive Support

2010-06-18 Thread David Nolen
On Fri, Jun 18, 2010 at 1:44 AM, Antony Blakey antony.bla...@gmail.comwrote: On Fri, Jun 18, 2010 at 12:24 AM, Antony Blakey antony.bla...@gmail.com wrote: This proposal is IMO a very bad idea. Why do you need know? You're assumption is built on someone writing a writing a bad library (one

Re: Enhanced Primitive Support

2010-06-18 Thread Mark Engelberg
On Thu, Jun 17, 2010 at 11:01 PM, David Nolen dnolen.li...@gmail.com wrote: What's the problem? David It's a composability issue. Elaborating on Anthony's explanation, let's say you call (fact (foo n)). Do you know what values of n, when passed to foo, produce a value large enough that fact

Re: Leiningen documentation review?

2010-06-18 Thread Howard Lewis Ship
I've been using Lein in earnest the last couple of days, prepping for a talk on Clojure for OSCON. I'm hitting enough issues to make me think that 1.2 needs a bit of TLC before a release. Don't get me wrong; I like Lein, how easy it installs, and how focused it is. I'm just finding that, despite

Re: Upgrade from 1.1 to 1.2

2010-06-18 Thread Wilson MacGyver
^ was deprecated in 1.1 as per release note below The ^ reader macro has been deprecated as a shortcut for meta in the hopes that it can eventually replace the #^ reader macro. On Jun 18, 2010, at 2:20 AM, Howard Lewis Ship hls...@gmail.com wrote: I've noticed a few issues upgrading from 1.1

Re: Enhanced Primitive Support

2010-06-18 Thread David Nolen
On Fri, Jun 18, 2010 at 2:10 AM, Mark Engelberg mark.engelb...@gmail.comwrote: Elaborating on Anthony's explanation, let's say you call (fact (foo n)). This imposes too high a burden on any programmer who cares about safety. Don't buy it. That's the whole point of BigInt contagion. If

Re: Upgrade from 1.1 to 1.2

2010-06-18 Thread Laurent PETIT
Hi, 2010/6/18 Wilson MacGyver wmacgy...@gmail.com: ^ was deprecated in 1.1 as per release note below The ^ reader macro has been deprecated as a shortcut for meta in the hopes that it can eventually replace the #^ reader macro. No, it's not that gray: in 1.2 (so in clojure master, and all new

Re: Enhanced Primitive Support

2010-06-18 Thread Richard Newman
This imposes too high a burden on any programmer who cares about safety. Don't buy it. That's the whole point of BigInt contagion. If fact and foo are correctly written this will work. It only takes one library to screw up, and the whole stack falls down. Screwing up can occur because of

Re: Miscellaneous noob questions

2010-06-18 Thread Baishampayan Ghose
Jared wrote: I'm a little confused over when to use a var vs. a ref vs. an agent vs. an atom. For writing small (200 lines) single-threaded programs when do I want to use each one? ref - When you need to mutate multiple things together synchronously. atom - When you need to mutate a single

Re: Enhanced Primitive Support

2010-06-18 Thread Antony Blakey
On 18/06/2010, at 4:28 PM, Richard Newman wrote: This imposes too high a burden on any programmer who cares about safety. Don't buy it. That's the whole point of BigInt contagion. If fact and foo are correctly written this will work. It only takes one library to screw up, and the whole

Re: Miscellaneous noob questions

2010-06-18 Thread Meikel Brandmeyer
Hi, On Jun 18, 9:01 am, Baishampayan Ghose b.gh...@ocricket.com wrote: ref - When you need to mutate multiple things together synchronously. I'd like to add: When you need to mutate one thing several times synchronously. Sincerely Meikel -- You received this message because you are

Re: Enhanced Primitive Support

2010-06-18 Thread Chris Dean
Richard Newman holyg...@gmail.com writes: Having digested Rich's notes, pretty much the only thing that I disagree with is the lack of automatic bignum promotion/demotion. It seems like too much of a bad tradeoff, This nicely summarizes my thoughts. The other parts of Rich's notes seem very

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
Dear all, just finished to read the proposals. - prim is great and would allow to keep performance in more idiomatic code - I am pro-num. It allows to get read of plenty of annotations or java methods. Annotations are difficult for beginners, makes code hard to read, maintain and modify, even

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
On a totally different point: is there a way of having he equivalent of #^final/#^static for defs? Sometimes, you know a def won't be dynamically bound/redefined. Would there be a benefit for the JITed code (less memory barriers or more asm reordering) to give a way to pass this information to

Re: Enhanced Primitive Support

2010-06-18 Thread Christophe Grand
On Fri, Jun 18, 2010 at 8:58 AM, Richard Newman holyg...@gmail.com wrote: It only takes one library to screw up, and the whole stack falls down. Screwing up can occur because of omission (fact being written with a 1, not 1N, and not being tested with large inputs), or by design. It can already

Re: Miscellaneous noob questions

2010-06-18 Thread Meikel Brandmeyer
Hi, On Jun 18, 12:12 pm, Baishampayan Ghose b.gh...@ocricket.com wrote: Yep. Thanks for the correction, Meikel. I would say addition, not correction. What you said is was absolutely correct. :) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups

Re: Miscellaneous noob questions

2010-06-18 Thread Baishampayan Ghose
Meikel Brandmeyer wrote: ref - When you need to mutate multiple things together synchronously. I'd like to add: When you need to mutate one thing several times synchronously. Yep. Thanks for the correction, Meikel. Regards, BG -- Baishampayan Ghose b.gh...@ocricket.com oCricket.com -- You

Re: Enhanced Primitive Support

2010-06-18 Thread Michał Marczyk
On 18 June 2010 05:57, Mark Engelberg mark.engelb...@gmail.com wrote: I assume that most Clojure users really like its dynamic nature.  If this is true, then for most of us, the common case is to NOT annotate our code with types.  Certainly I like the idea of making it as easy as possible to

Re: Enhanced Primitive Support

2010-06-18 Thread Carson
Just tried out num branch and I really like how easy it is to be fast! However... Consider: (defn fact [n] (if (zero? n) 1 (* n (fact (dec n) (defn twice-fact [n] (fact (fact n))) (defn bad-twice-fact [n] (fact (- n fact range last inc))) user= (fact (fact 5))

compiling the instructions of a simple vm into a function

2010-06-18 Thread Eugen Dück
Recently, I implemented last year's ICFP problem. Part of it is writing a VM that consists of memory slots, some registers and input and input ports. It takes a list of instructions, works them off one after the other, reading from input or memory, calculating something and the changing registers

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
On Fri, Jun 18, 2010 at 11:47 AM, Carson c.sci.b...@gmail.com wrote: Don't buy it. That's the whole point of BigInt contagion. If fact and foo are correctly written this will work. BigInt contagion doesn't help if in some convoluted manner a BigInt's value is used to construct a primitive

Re: Enhanced Primitive Support

2010-06-18 Thread Carson
On Jun 18, 2:44 am, Christophe Grand christo...@cgrand.net wrote: With contagious bigints (let's nick name them safeints and assume they are not BigInteger but something à la kawa) a single N on literals or having all your inputs going through a safeint conversion would trigger safe

Re: Enhanced Primitive Support

2010-06-18 Thread Carson
On Jun 18, 4:22 am, Nicolas Oury nicolas.o...@gmail.com wrote: On Fri, Jun 18, 2010 at 11:47 AM, Carson c.sci.b...@gmail.com wrote: Don't buy it. That's the whole point of BigInt contagion. If fact and foo are correctly written this will work. BigInt contagion doesn't help if in some

Re: Enhanced Primitive Support

2010-06-18 Thread Laurent PETIT
I'm no expert in this field. What I would like to avoid, is having to become expert in the field to expect the prevention of more : * nightmare debug sessions because of my own code or third party libraries code * crash in production code which might derive from the choices. I tend to

Re: Enhanced Primitive Support

2010-06-18 Thread Laurent PETIT
2010/6/18 Carson c.sci.b...@gmail.com: And *still*, I'm in favour of fast by default, with an *easy* way to make things safe as an option. The key is to make the safe option *easy*. The solution is easy: write java code by default, and clojure code when you want to be safe :-p -- You

Re: Enhanced Primitive Support

2010-06-18 Thread Lee Spector
I too think that correct by default is a much better idea than fast by default. One way I think about this is that the meaning of +, for example, is the sum of its numeric arguments. The performance characteristics are not part of this core meaning, although of course everyone will be

Re: Miscellaneous noob questions

2010-06-18 Thread Craig Andera
I'm a little confused over when to use a var vs. a ref vs. an agent vs. an atom. For writing small (200 lines) single-threaded programs when do I want to use each one? In addition to the great answers you got here, you could have a look at my screencast series on vars, refs, agents, and atoms:

Re: Enhanced Primitive Support

2010-06-18 Thread David Nolen
On Fri, Jun 18, 2010 at 6:47 AM, Carson c.sci.b...@gmail.com wrote: (defn fact [n] (if (zero? n) 1 (* n (fact (dec n) (defn twice-fact [n] (fact (fact n))) (defn bad-twice-fact [n] (fact (- n fact range last inc))) Not only is it contrived, under the proposal, this implementation of fact

Re: Problems with URL params and http-agent

2010-06-18 Thread Timothy Washington
Hmm, this is a good idea and I got the GET request string as... */exist/rest/rootDir/system.main.system/aauthentication.main.authentication/users.aauth.users/user.one/user.one?_wrap=no_query=declare default element namespace 'com/interrupt/bookkeeping/users';//user[ @id='one']* This exact URI

Re: Problems with URL params and http-agent

2010-06-18 Thread Timothy Washington
Oh... and the /tmp/out file is empty. Tim On Fri, Jun 18, 2010 at 8:53 AM, Timothy Washington twash...@gmail.comwrote: Hmm, this is a good idea and I got the GET request string as...

Re: Problems with URL params and http-agent

2010-06-18 Thread Timothy Washington
That's a good idea which I tried. But no dice. I have a feeling I'm not handling the response properly in Clojure. See my other posts here. Tim On Thu, Jun 17, 2010 at 3:57 PM, RandyHudson randy_hud...@mac.com wrote: You don't want to encode the whole URL, just the keys and values in the

Re: Enhanced Primitive Support

2010-06-18 Thread Konrad Hinsen
On 18.06.2010, at 14:49, Rich Hickey wrote: I don't see a way around this fundamental dichotomy. The semantics for + should be unified, and the operator that makes the other choice needs to be called something else, or placed somewhere else. My preference would be placed somewhere else. We

Re: Enhanced Primitive Support

2010-06-18 Thread Rich Hickey
On Jun 18, 2010, at 6:47 AM, Carson wrote: Just tried out num branch and I really like how easy it is to be fast! However... Consider: (defn fact [n] (if (zero? n) 1 (* n (fact (dec n) (defn twice-fact [n] (fact (fact n))) (defn bad-twice-fact [n] (fact (- n fact range last inc)))

Re: Enhanced Primitive Support

2010-06-18 Thread Carson
On Jun 18, 5:45 am, David Nolen dnolen.li...@gmail.com wrote: On Fri, Jun 18, 2010 at 6:47 AM, Carson c.sci.b...@gmail.com wrote: (defn fact [n] (if (zero? n) 1 (* n (fact (dec n) (defn twice-fact [n] (fact (fact n))) (defn bad-twice-fact [n] (fact (- n fact range last inc))) Not only

Re: Enhanced Primitive Support

2010-06-18 Thread Rich Hickey
On Jun 18, 2010, at 8:56 AM, Konrad Hinsen wrote: On 18.06.2010, at 14:49, Rich Hickey wrote: I don't see a way around this fundamental dichotomy. The semantics for + should be unified, and the operator that makes the other choice needs to be called something else, or placed somewhere

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
On Fri, Jun 18, 2010 at 2:20 PM, Rich Hickey richhic...@gmail.com wrote: On Jun 18, 2010, at 8:56 AM, Konrad Hinsen wrote: On 18.06.2010, at 14:49, Rich Hickey wrote: I don't see a way around this fundamental dichotomy. The semantics for + should be unified, and the operator that makes

Re: Enhanced Primitive Support

2010-06-18 Thread Laurent PETIT
2010/6/18 Rich Hickey richhic...@gmail.com: I want it to be perfectly clear to everyone, this is not a choice between good math and bad math, i.e. C/Java style truncating/wrapping of results. That will never be the default. Such silent truncation/wrap is truly unsafe, and often the proposed

Re: Enhanced Primitive Support

2010-06-18 Thread Laurent PETIT
2010/6/18 Nicolas Oury nicolas.o...@gmail.com: On Fri, Jun 18, 2010 at 2:20 PM, Rich Hickey richhic...@gmail.com wrote: On Jun 18, 2010, at 8:56 AM, Konrad Hinsen wrote: On 18.06.2010, at 14:49, Rich Hickey wrote: I don't see a way around this fundamental dichotomy. The semantics for +

Re: Enhanced Primitive Support

2010-06-18 Thread Carson
On Jun 18, 6:11 am, Rich Hickey richhic...@gmail.com wrote: On Jun 18, 2010, at 6:47 AM, Carson wrote: Just tried out num branch and I really like how easy it is to be fast!  However... Consider: (defn fact [n] (if (zero? n) 1 (* n (fact (dec n) (defn twice-fact [n] (fact (fact

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
On Fri, Jun 18, 2010 at 2:35 PM, Laurent PETIT laurent.pe...@gmail.comwrote: No please, not even in my worst nightmares ! Semantic changing compilation flags ? So I use lib A which needs lib B compiled with flags C and D, but I also use lib E which needs lib B compiled with other values for

Re: Enhanced Primitive Support

2010-06-18 Thread Stuart Halloway
While I enjoy a theoretical debate as much as the next person, it would be nice to see (1) examples of real code that fail on reasonable inputs, if this change were made. And how difficult it would be to fix them. (2) examples of real code that get way faster, and the ease of making

Re: Enhanced Primitive Support

2010-06-18 Thread Christophe Grand
On Fri, Jun 18, 2010 at 2:49 PM, Rich Hickey richhic...@gmail.com wrote: This L suffix idea is a non-starter. Here's why: We're in a reader based language. The reader reads objects. When the reader reads 42, it must return an object. It cannot return an int or a long primitive. Right now, it

Re: Enhanced Primitive Support

2010-06-18 Thread Heinz N. Gies
On Jun 18, 2010, at 15:11 , Rich Hickey wrote: So, let's go easy on the hyperbole. The behavior might not be what you desire, but it is not unsafe. I agree with both actually it isn't unsafe but in my eyes undesired, met me explain. In generally it seems we have two options: 1) We make fast

Re: Enhanced Primitive Support

2010-06-18 Thread Stuart Halloway
So the same code now risks an arithmetic exception. What have I, the programmer, gained from this new level of risk? The answer, if I'm the kind of programmer who has no interest in putting in type annotations into the header of the function, is nothing. There is no speed improvement

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
On Fri, Jun 18, 2010 at 3:11 PM, Heinz N. Gies he...@licenser.net wrote: But lets look at the other side of the coin, performance. We all want it - of cause otherwise we'd put a lot of (Thread/sleep 1000) in our code but, again lets face the reality, most of us don't need it. Most of the time

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
I meant: (= (* 20 (+ not-a-bottleneck-1 ... not-a-bottleneck-250)) not-a-bottleneck) -- 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: Enhanced Primitive Support

2010-06-18 Thread Heinz N. Gies
On Jun 18, 2010, at 16:24 , Nicolas Oury wrote: I am not sure (= (* 20 not-a-bottleneck) not-a-bottleneck) or more precisely: (= (* 20 not-a-bottleneck-1 ... not-a-bottleneck-250) not-a-bottleneck) Point is, no one will write 250 variables even less so values by hand, it will be a map,

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
Point is, no one will write 250 variables even less so values by hand, it will be a map, reduce or whatever and then it's pretty easy to type hint it if the performance is an issue at this point and if you write this code you likely will know that this is a bottleneck. (I ignore the * there

Clojure / Common Lisp Question

2010-06-18 Thread rob levy
As an informal survey of people who use both Clojure and Common Lisp for different projects, what do you see as the main determining factors behind your choice to use either Clojure or Common Lisp for a project, given the present state of Clojure. Let's only assume we are talking about projects

Re: Leiningen documentation review?

2010-06-18 Thread Chris Perkins
On Jun 17, 12:24 am, Phil Hagelberg p...@hagelb.org wrote: Mostly I'd like feedback on the tutorial:http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md But if you've got some time to look over the readme, that would be great

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
Experiment results : I switched a program to num. It was quite straightforward. First I had to replace a few unchecked-add by +. Has unchecked-add changed name? (I use it for indices when itering on a java array, if there is an overflow, you will know it beforehand) The only funny event is that

Re: Problems with URL params and http-agent

2010-06-18 Thread Michael Wood
On 18 June 2010 14:53, Timothy Washington twash...@gmail.com wrote: Hmm, this is a good idea and I got the GET request string as... /exist/rest/rootDir/system.main.system/aauthentication.main.authentication/users.aauth.users/user.one/user.one?_wrap=no_query=declare default element namespace

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

2010-06-18 Thread Nicolas Oury
First a simple version, equivalent to yours but more readable. (defmacro compile-instructions [instructions] (let [memory (gensym memory-)] `(fn [~memory] ~@(map (fn [[op m1 m2]] `(aset ~memory ~m1 (~op (aget ~memory ~m1) (aget ~memory ~m2

Re: Enhanced Primitive Support

2010-06-18 Thread Hugo Duncan
On Fri, 18 Jun 2010 09:20:35 -0400, Rich Hickey richhic...@gmail.com wrote: On Jun 18, 2010, at 8:56 AM, Konrad Hinsen wrote: On 18.06.2010, at 14:49, Rich Hickey wrote: I don't see a way around this fundamental dichotomy. The semantics for + should be unified, and the operator that makes

Re: Upgrade from 1.1 to 1.2

2010-06-18 Thread Howard Lewis Ship
On Thu, Jun 17, 2010 at 11:50 PM, Laurent PETIT laurent.pe...@gmail.com wrote: Hi, 2010/6/18 Wilson MacGyver wmacgy...@gmail.com: ^ was deprecated in 1.1 as per release note below The ^ reader macro has been deprecated as a shortcut for meta in the hopes that it can eventually replace the #^

Re: Leiningen documentation review?

2010-06-18 Thread Brian Carper
On Jun 16, 9:24 pm, Phil Hagelberg p...@hagelb.org wrote: Mostly I'd like feedback on the tutorial:http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md It looks quite good. Maybe some mention of `lein clean` is warranted. It would preclude a lot of the Hey I just upgraded library

Re: Leiningen documentation review?

2010-06-18 Thread Phil Hagelberg
On Fri, Jun 18, 2010 at 8:20 AM, Chris Perkins chrisperkin...@gmail.com wrote: On Jun 17, 12:24 am, Phil Hagelberg p...@hagelb.org wrote: This sentence in the README: On Windows you can download lein.bat contains a link to an old and busted version of lein.bat that can only lead to tears and

Re: Leiningen documentation review?

2010-06-18 Thread Phil Hagelberg
On Fri, Jun 18, 2010 at 10:14 AM, Brian Carper briancar...@gmail.com wrote: It looks quite good.  Maybe some mention of `lein clean` is warranted.  It would preclude a lot of the Hey I just upgraded library X and now everything is broken kinds of questions I see on various mailing lists.

Re: Upgrade from 1.1 to 1.2

2010-06-18 Thread Howard Lewis Ship
I've noticed that logging has moved into clojure.jar ... could Clojure start leveraging logging to identify what namespace its compiling and why; I'd love to see something like: [Compiler] Compiling namepace cascade [Compiler] Namespace cascade imports namespace cascade.asset [Compiler] Compiling

Re: Enhanced Primitive Support

2010-06-18 Thread Mark Engelberg
On Thu, Jun 17, 2010 at 9:06 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: It will be much easier for people to write fast library code (including in Clojure and contrib). So if you ever use Clojure libraries, you will get a speed boost. I am skeptical of this claim. Since static

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
- There is a speedup without static or annotation. - Static keep the dynamic semantic, if I understood well the proposal (only direct first-order call are static) On Fri, Jun 18, 2010 at 6:51 PM, Mark Engelberg mark.engelb...@gmail.comwrote: On Thu, Jun 17, 2010 at 9:06 PM, Stuart Halloway

Re: code review request: clojure.java.io

2010-06-18 Thread Rasmus Svensson
2010/5/11 Stuart Halloway stuart.hallo...@gmail.com Assembla Ticket #311 [1] calls for the promotion of clojure.contrib.iointo clojure (as clojure.java.io). I have attached a patch, and am requesting comments and code review from the community. I think I have found a bug in the

Re: Enhanced Primitive Support

2010-06-18 Thread miner
On Jun 18, 8:49 am, Rich Hickey richhic...@gmail.com wrote: Fixing it requires adopting a single   semantic for +. Choosing auto-promotion precludes the use of + on   primitives, a huge loss IMO. Choosing throw-on-overflow precludes auto- promotion, but preserves polymorphism otherwise, and

Re: Leiningen documentation review?

2010-06-18 Thread Chris Perkins
On Jun 18, 1:21 pm, Phil Hagelberg p...@hagelb.org wrote: On Fri, Jun 18, 2010 at 8:20 AM, Chris Perkins chrisperkin...@gmail.com wrote: This sentence in the README: On Windows you can download lein.bat contains a link to an old and busted version of lein.bat that can only lead to tears

Re: Enhanced Primitive Support

2010-06-18 Thread Rich Hickey
I've revised and enhanced the strategy, based upon the feedback here. I think it is a nice compromise. Docs (see update section at the top) https://www.assembla.com/wiki/show/b4-TTcvBSr3RAZeJe5aVNr/Enhanced_Primitive_Support Code:

Re: Enhanced Primitive Support

2010-06-18 Thread Heinz N. Gies
On Jun 18, 2010, at 22:52 , Rich Hickey wrote: I've revised and enhanced the strategy, based upon the feedback here. I think it is a nice compromise. I agree this is a very nice compromise :) great work again and it is really cool to see how a community effort shapes clojure itself :D

Re: Enhanced Primitive Support

2010-06-18 Thread David Nolen
On Fri, Jun 18, 2010 at 4:52 PM, Rich Hickey richhic...@gmail.com wrote: I've revised and enhanced the strategy, based upon the feedback here. I think it is a nice compromise. Docs (see update section at the top)

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

2010-06-18 Thread Jared
I was following the instructions to get labrepl up and running and hit a snag. Netbeans does not recognize Samples/Clojure/Relevance LabReplProject as a project. After creating it it does not appear in the Projects window. So I go to File - Open Project and click on RelevanceLabRepl and hit Open

Re: Enhanced Primitive Support

2010-06-18 Thread Paul Moore
On 18 June 2010 15:08, Stuart Halloway stuart.hallo...@gmail.com wrote: While I enjoy a theoretical debate as much as the next person, it would be nice to see (1) examples of real code that fail on reasonable inputs, if this change were made. And how difficult it would be to fix them. (2)

Possible Clojure Bug

2010-06-18 Thread pleone
I ran this in a slime REPL on AQUAMACS with clojure 1.1. It appears to be a bug. Am I mistaken? user (def conj-test-vector [1 2 3 4]) #'user/conj-test-vector user conj-test-vector [1 2 3 4] user (conj conj-test-vector 5) [1 2 3 4 5] user (conj conj-test-vector [test]) [1 2 3 4 [test]] user (conj

Delete my last post

2010-06-18 Thread pleone
Mistake there is no error -- 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 - please be patient with your first post. To unsubscribe from this

Re: parallel vs serial iteration in a for loop

2010-06-18 Thread viksit
Hey Meikel, On Jun 17, 10:48 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, On Jun 18, 1:35 am, viksit vik...@gmail.com wrote: (loop for x in '(a b c d e)       for y in '(1 2 3 4 5)       collect (list x y) ) ((A 1) (B 2) (C 3) (D 4) (E 5)) Are there any good (and idiomatic)

Re: Enhanced Primitive Support

2010-06-18 Thread Daniel
Save for the new equality semantics (bravo!), most of this can be viewed as a loss for newcomers to the language, especially those using project euler to learn the language. Shame you've been unable to think of some way to garuntee top performance while keeping overflow prevention the norm. On

Re: Enhanced Primitive Support

2010-06-18 Thread Daniel
This also seems to break the principle of make it work, make it right, make it fast. Math in Clojure isn't to the point that it works well yet. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

classpath and require

2010-06-18 Thread Mohammad Khan
C:\Projects.cljjava -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 examples/introduction.clj on classpath:

Re: Enhanced Primitive Support

2010-06-18 Thread Michał Marczyk
On 18 June 2010 21:47, Daniel doubleagen...@gmail.com wrote: Save for the new equality semantics (bravo!), most of this can be viewed as a loss for newcomers to the language, especially those using project euler to learn the language.  Shame you've been unable to think of some way to garuntee

Re: How to derive a protocol from another protocol?

2010-06-18 Thread David Nolen
Unless I'm mistaken, protocols cannot be derived. David -- 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 - please be patient with your first

Re: classpath and require

2010-06-18 Thread Rob Lachlan
have you tried starting with: c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar;c: \projects.clj clojure.main On Jun 18, 2:00 pm, Mohammad Khan beepl...@gmail.com wrote: C:\Projects.cljjava -cp c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar clojure.main Clojure

Re: Enhanced Primitive Support

2010-06-18 Thread Heinz N. Gies
On Jun 18, 2010, at 22:02 , Daniel wrote: This also seems to break the principle of make it work, make it right, make it fast. Math in Clojure isn't to the point that it works well yet. Daniel the decision was to keep things working and add speed as an option by using +' (and friends)

Re: How to derive a protocol from another protocol?

2010-06-18 Thread Nicolas Oury
I believe that too. It is not clear to me why you would need that without static typing. On Fri, Jun 18, 2010 at 10:50 PM, David Nolen dnolen.li...@gmail.comwrote: Unless I'm mistaken, protocols cannot be derived. David -- You received this message because you are subscribed to the

scala

2010-06-18 Thread cageface
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 and giving Java developers a path forward. I also don't think Clojure vs x language battles are very productive and don't want

Re: classpath and require

2010-06-18 Thread Rob Lachlan
Whoops, that should read: java -cp c:\clojure-contrib\clojure-contrib.jar;c:\clojure \clojure.jar;c: \projects.clj clojure.main On Jun 18, 2:51 pm, Rob Lachlan robertlach...@gmail.com wrote: have you tried starting with: c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar;c:

Re: Possible Clojure Bug

2010-06-18 Thread Rob Lachlan
I think he retracted this post in a separate new thread not long after posting this. cheers Rob On Jun 18, 2:56 pm, Heinz N. Gies he...@licenser.net wrote: On Jun 18, 2010, at 18:48 , pleone wrote: I ran this in a slime REPL on AQUAMACS with clojure 1.1. It appears to be a bug.  Am I

Re: Enhanced Primitive Support

2010-06-18 Thread Mark Engelberg
On Fri, Jun 18, 2010 at 1:52 PM, Rich Hickey richhic...@gmail.com wrote: I've revised and enhanced the strategy, based upon the feedback here. I think it is a nice compromise. Looks good to me. -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Enhanced Primitive Support

2010-06-18 Thread Michał Marczyk
In connection to a conversation on #clojure (in progress as I write)... Apparently loop/recur locals are now primitive by default: (defn fact [n] (loop [n n r 1] (if (zero? n) r ;; note the regular * on the next line (recur (dec n) (* r n) will throw

Re: Enhanced Primitive Support

2010-06-18 Thread Heinz N. Gies
On Jun 18, 2010, at 22:52 , Rich Hickey wrote: Thanks to all for the feedback, keep it coming! Okay you asked for it :P to quote from the IRC: mmarczyk: also, (defn fact [n] (loop [n n r 1] (if (zero? n) 1 (recur (dec n) (* r n) throws on (fact 40) -- that's with *, not *' and it

Re: scala

2010-06-18 Thread Mark Engelberg
I've spent a number of years looking for a functional programming language suitable for the kind of work I do. evaluating Clojure, Haskell, Erlang, Scala, F#, Mozart, ML, Clean, Racket, and probably some others I'm not thinking about right now. For me, once Clojure hit 1.0 status, it was clearly

Re: parallel vs serial iteration in a for loop

2010-06-18 Thread Moritz Ulrich
Personally, I think the cl loop-macro is kind of ugly. Yes, it's a nice dsl for looping, but it is almost too powerful for my taste. Too complicated to learn, if you can accomplish the same thing with sexps. However, you can combine doseq, destructuring and the map-stuff by Meikel Brandmeyer to

Re: Enhanced Primitive Support

2010-06-18 Thread Heinz N. Gies
On Jun 19, 2010, at 0:32 , Heinz N. Gies wrote: On Jun 18, 2010, at 22:52 , Rich Hickey wrote: Thanks to all for the feedback, keep it coming! Another one: http://gist.github.com/444344 This is the same problem as with the exception but this time it does not crash just return very odd

Re: classpath and require

2010-06-18 Thread Mohammad Khan
No, it didn't work.. what else I could be missing.. On Fri, Jun 18, 2010 at 5:56 PM, Rob Lachlan robertlach...@gmail.comwrote: Whoops, that should read: java -cp c:\clojure-contrib\clojure-contrib.jar;c:\clojure \clojure.jar;c: \projects.clj clojure.main On Jun 18, 2:51 pm, Rob Lachlan

Re: Enhanced Primitive Support

2010-06-18 Thread Daniel
Sorry guys - missed that latest post. This new approach is something I can definitely get behind. :) -- 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

Basic toolset for non-Java programmer

2010-06-18 Thread Paul Moore
I'm wondering, what would be a useful basic set of tools for a newcomer to Clojure with no Java background? I'm not really talking about IDEs (everyone has their own opinions about IDEs, and I've seen some discussions elsewhere to give me some pointers on that one). I'm more interested in things

Re: scala

2010-06-18 Thread RandyHudson
Bear in mind that Scala is about 5 years older than Clojure, so it's had more time to build up momentum. On Jun 18, 5:56 pm, cageface milese...@gmail.com wrote: Unfortunately there seems to be a lot more commercial momentum for Scala though. It's still a blip compared to the mainstream

Re: Enhanced Primitive Support

2010-06-18 Thread Rich Hickey
Turnabout is fair play, so I've produced a version that swaps the defaults, still in the 'equal' branch: Docs: https://www.assembla.com/wiki/show/b4-TTcvBSr3RAZeJe5aVNr/Enhanced_Primitive_Support Code: http://github.com/richhickey/clojure/commit/310534b8e7e7f28c75bb122b4bf1bee320cdae67 You

Re: Enhanced Primitive Support

2010-06-18 Thread Aaron Cohen
I've also temporarily enabled a diagnostic (in both) that tells you when you have a mismatch between a loop initializer and its recur form. It goes off over a hundred times in Clojure itself, when using the arbitrary precision default. In each case, the recur value is needlessly being boxed,

Re: Enhanced Primitive Support

2010-06-18 Thread Mark Engelberg
An idea to consider: How about keeping the arbitrary-precision default, but add a loop' construct to the family of +',-',*',inc', and dec' for primitive optimization? The loop' construct would bind primitive literals, whereas the loop construct would keep the literals boxed, so people who don't

Re: Enhanced Primitive Support

2010-06-18 Thread Rich Hickey
On Jun 18, 2010, at 9:52 PM, Aaron Cohen wrote: I've also temporarily enabled a diagnostic (in both) that tells you when you have a mismatch between a loop initializer and its recur form. It goes off over a hundred times in Clojure itself, when using the arbitrary precision default. In each

Re: Enhanced Primitive Support

2010-06-18 Thread Mark Fredrickson
So far most of the action has concerned arithmetic ops (+, -, *, /). Will these new semantics include the bit-shift operators? I vote yes. My use cases for bit ops would benefit from primitive ops. On a related note, my use cases call for silent overflow of bit shifts (pseudo random number

Re: Enhanced Primitive Support

2010-06-18 Thread Rich Hickey
On Jun 18, 2010, at 10:09 PM, Mark Engelberg wrote: An idea to consider: How about keeping the arbitrary-precision default, but add a loop' construct to the family of +',-',*',inc', and dec' for primitive optimization? The loop' construct would bind primitive literals, whereas the loop

Re: Enhanced Primitive Support

2010-06-18 Thread Rich Hickey
On Jun 18, 2010, at 10:18 PM, Mark Fredrickson wrote: So far most of the action has concerned arithmetic ops (+, -, *, /). Will these new semantics include the bit-shift operators? I vote yes. My use cases for bit ops would benefit from primitive ops. On a related note, my use cases call for

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

2010-06-18 Thread Eugen Dück
Thanks Nicolas, your first variant resembles the generated code much closer than my initial approach, which is great. I need the eval though, to be able to pass in non literals. In my real program I'm reading the instructions from a binary file. So if I want to be able to do something like this:

  1   2   >