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 thi

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 t

Re: Miscellaneous noob questions

2010-06-18 Thread Meikel Brandmeyer
Hi, On Jun 18, 9:01 am, Baishampayan Ghose 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 subscribed to the Google Gro

Re: Enhanced Primitive Support

2010-06-18 Thread Chris Dean
Richard Newman 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 elegant, but I ca

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 the

Re: Enhanced Primitive Support

2010-06-18 Thread Christophe Grand
On Fri, Jun 18, 2010 at 8:58 AM, Richard Newman 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 happen: a l

Re: Miscellaneous noob questions

2010-06-18 Thread Meikel Brandmeyer
Hi, On Jun 18, 12:12 pm, Baishampayan Ghose 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 "Clojure" group. To

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 oCricket.com -- You received this messag

Re: Enhanced Primitive Support

2010-06-18 Thread Michał Marczyk
On 18 June 2010 05:57, Mark Engelberg 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 write fast code in Clo

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)) java.lang.ArithmeticExceptio

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 o

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
On Fri, Jun 18, 2010 at 11:47 AM, Carson 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 sufficiently lar

Re: Enhanced Primitive Support

2010-06-18 Thread Carson
On Jun 18, 2:44 am, Christophe Grand 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 computations (unless you t

Re: Enhanced Primitive Support

2010-06-18 Thread Carson
On Jun 18, 4:22 am, Nicolas Oury wrote: > On Fri, Jun 18, 2010 at 11:47 AM, Carson 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

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 think

Re: Enhanced Primitive Support

2010-06-18 Thread Laurent PETIT
2010/6/18 Carson : > 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 received this message bec

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 hap

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 ato

Re: Enhanced Primitive Support

2010-06-18 Thread David Nolen
On Fri, Jun 18, 2010 at 6:47 AM, Carson 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 is broken. It n

Re: Enhanced Primitive Support

2010-06-18 Thread ajuc
+1 to safe-by-default. I use clojure for games, but if it will be possible to easily make computations fast, safe-by-default is more important. -- 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: Enhanced Primitive Support

2010-06-18 Thread Rich Hickey
On Jun 18, 2010, at 1:23 AM, Mark Engelberg wrote: On Thu, Jun 17, 2010 at 9:20 PM, David Nolen wrote: The problem is that it distinctly *not* easy to write fast numeric code in Clojure. It requires expert Clojure knowledge. Right, but with just the prim branch and a shorthand for long

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 (be

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 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&_quer

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 wrote: > You don't want to encode the whole URL, just the keys and values in > the query string. Somethin

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".

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))) user

Re: Enhanced Primitive Support

2010-06-18 Thread Carson
On Jun 18, 5:45 am, David Nolen wrote: > On Fri, Jun 18, 2010 at 6:47 AM, Carson 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 propo

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 else

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
On Fri, Jun 18, 2010 at 2:20 PM, Rich Hickey 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 the other c

Re: Enhanced Primitive Support

2010-06-18 Thread Laurent PETIT
2010/6/18 Rich Hickey : > 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 alternative. It was

Re: Enhanced Primitive Support

2010-06-18 Thread Laurent PETIT
2010/6/18 Nicolas Oury : > > > On Fri, Jun 18, 2010 at 2:20 PM, Rich Hickey 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, an

Re: Enhanced Primitive Support

2010-06-18 Thread Carson
On Jun 18, 6:11 am, Rich Hickey 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 n))) > > (

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
On Fri, Jun 18, 2010 at 2:35 PM, Laurent PETIT wrote: > > 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 the flags ... I thi

Re: Enhanced Primitive Support

2010-06-18 Thread Rich Hickey
On Jun 17, 2010, at 11:57 PM, Mark Engelberg wrote: Thanks for the responses. Going back to the naive factorial function: (defn fact [n] (if (zero? n) 1 (* n (fact (dec n) Right now, user=> (fact 40) 8159152832478977343456112695961158942720 Under the proposed changes, user=> (fa

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 those

Re: Enhanced Primitive Support

2010-06-18 Thread Christophe Grand
On Fri, Jun 18, 2010 at 2:49 PM, Rich Hickey 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 returns an Integ

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 fas

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 w

Re: Enhanced Primitive Support

2010-06-18 Thread Nicolas Oury
On Fri, Jun 18, 2010 at 3:11 PM, Heinz N. Gies 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 we > don't nee

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 - plea

Re: Enhanced Primitive Support

2010-06-18 Thread Rich Hickey
On Jun 18, 2010, at 10:09 AM, Christophe Grand wrote: On Fri, Jun 18, 2010 at 2:49 PM, Rich Hickey 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 i

Re: Leiningen documentation review?

2010-06-18 Thread Phil Hagelberg
On Thu, Jun 17, 2010 at 11:14 PM, Howard Lewis Ship wrote: > 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

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

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 yo

Re: Leiningen documentation review?

2010-06-18 Thread Chris Perkins
On Jun 17, 12:24 am, Phil Hagelberg 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 too:http://github.com/technomancy/leiningen/blob/master/README.md

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 i

Re: Problems with URL params and http-agent

2010-06-18 Thread Michael Wood
On 18 June 2010 14:53, Timothy Washington 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 'com/interrupt/boo

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 inst

Re: Enhanced Primitive Support

2010-06-18 Thread Hugo Duncan
On Fri, 18 Jun 2010 09:20:35 -0400, Rich Hickey 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 the other choice n

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 wrote: > Hi, > > 2010/6/18 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. > > No, it's not th

Re: Leiningen documentation review?

2010-06-18 Thread Brian Carper
On Jun 16, 9:24 pm, Phil Hagelberg 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 X and now eve

Re: Leiningen documentation review?

2010-06-18 Thread Phil Hagelberg
On Fri, Jun 18, 2010 at 8:20 AM, Chris Perkins wrote: > On Jun 17, 12:24 am, Phil Hagelberg 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 misery for new users :) Oh right;

Re: Leiningen documentation review?

2010-06-18 Thread Phil Hagelberg
On Fri, Jun 18, 2010 at 10:14 AM, Brian Carper 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. Definitely. > The p

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 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 functions lose some of the

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 wrote: > On Thu, Jun 17, 2010 at 9:06 PM, Stuart Halloway > wrote: > > It will be muc

Re: code review request: clojure.java.io

2010-06-18 Thread Rasmus Svensson
2010/5/11 Stuart Halloway > 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 clojure.contrib.io code. The cur

Re: Enhanced Primitive Support

2010-06-18 Thread miner
On Jun 18, 8:49 am, Rich Hickey 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 gives the   > compi

Re: Leiningen documentation review?

2010-06-18 Thread Chris Perkins
On Jun 18, 1:21 pm, Phil Hagelberg wrote: > On Fri, Jun 18, 2010 at 8:20 AM, Chris Perkins > 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 misery for new users :) > >

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: http://github.com/richhickey/clojure/commit/c79d28775e06b196a

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 Reg

Re: Enhanced Primitive Support

2010-06-18 Thread David Nolen
On Fri, Jun 18, 2010 at 4:52 PM, Rich Hickey 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) > > > https://www.assembla.com/wiki/show/b4-TTcvBSr3RAZeJe5aVNr/Enhanced_Primitive_Support > > Co

How to derive a protocol from another protocol?

2010-06-18 Thread Travis Hoffman
I'm trying to develop a hierarchy (of sorts) of protocols and I'm coming at it in from a Java Perspective, which I fully understand might be my problem. In Java, I would do something like this: interace A { public void aFoo(); } interface B { public void bFoo(); } interfacece AB extends A, B

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 P

Re: Enhanced Primitive Support

2010-06-18 Thread Paul Moore
On 18 June 2010 15:08, Stuart Halloway 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) examples of real cod

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 ["te

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 wrote: > Hi, > > On Jun 18, 1:35 am, viksit 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) methods to achieve

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 Ju

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

classpath and require

2010-06-18 Thread 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 examples/introduction.clj on classpath: (NO_

Re: Enhanced Primitive Support

2010-06-18 Thread Michał Marczyk
On 18 June 2010 21:47, Daniel 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 top performance whil

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 wrote: > C:\Projects.clj>java -cp > c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar clojure.main > Clojure 1.1.0-alpha-SNAPSH

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) sp

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 wrote: > Unless I'm mistaken, protocols cannot be derived. > > David > > -- > You received this message because you are subscribed to the Google > Groups "Cloju

Re: Problems with URL params and http-agent

2010-06-18 Thread Timothy Washington
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 :) On Fri, Jun 18, 2010 at 11:24 AM, Michael Wood wrote: > On 18 June 2010 14:53, Timothy Wash

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: Possible Clojure Bug

2010-06-18 Thread Heinz N. Gies
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 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

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 wrote: > have you tried starting with: > > c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar;c: > \projects.clj clojure.main

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" 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 mistaken? > > >

Re: Enhanced Primitive Support

2010-06-18 Thread Mark Engelberg
On Fri, Jun 18, 2010 at 1:52 PM, Rich Hickey 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 to this group, s

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 ArithmeticExcepti

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 trhow

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 lo

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

Clojure script in the classpath

2010-06-18 Thread Paul Moore
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? I come from a Python background (little or no Java experience) and the idea that anything other than .class or .jar files (or directories) could be on t

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 wrote: > 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 wrote: > > have yo

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 m

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 li

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 wrote: > Unfortunately there seems to be a lot more commercial momentum for > Scala though. It's still a blip compared to the mainstream languages > but I'm seein

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 can

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 box

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 w

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 cas

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 generat

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 constr

  1   2   >