Re: Enhanced Primitive Support

2010-06-17 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 o

Re: Upgrade from 1.1 to 1.2

2010-06-17 Thread Laurent PETIT
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 that gray: in 1.2 (so in clojure master, and all new branches like pr

Re: Enhanced Primitive Support

2010-06-17 Thread David Nolen
On Fri, Jun 18, 2010 at 2:10 AM, Mark Engelberg wrote: > 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 fact and foo are correctl

Re: Upgrade from 1.1 to 1.2

2010-06-17 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 wrote: > I've noticed a few issues upgrading from 1.1 to 1.2; I see tha

Upgrade from 1.1 to 1.2

2010-06-17 Thread Howard Lewis Ship
I've noticed a few issues upgrading from 1.1 to 1.2; I see that ^coll is no longer supporter; you now have to use (meta coll) instead. Some of the notes on new 1.2 features imply that ^ has changed meaning; it now looks like it's the type hint, rather than #^ ? Is this true? I've checked around

Re: Enhanced Primitive Support

2010-06-17 Thread David Nolen
On Fri, Jun 18, 2010 at 2:10 AM, Mark Engelberg wrote: > This imposes too high a burden on any programmer who cares about safety. Rich Hickey's branch work boil down to: 1) double/long crowd get to stop eating bark 2) BigInt crowd loses free lunch I'd say this is a bona fide community compromi

Re: Leiningen documentation review?

2010-06-17 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 b

Re: Enhanced Primitive Support

2010-06-17 Thread Mark Engelberg
On Thu, Jun 17, 2010 at 11:01 PM, David Nolen 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 will produce an excepti

Re: Enhanced Primitive Support

2010-06-17 Thread David Nolen
On Fri, Jun 18, 2010 at 1:44 AM, Antony Blakey wrote: > > On Fri, Jun 18, 2010 at 12:24 AM, Antony Blakey > 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 that doesn't handle long & BigInt that sho

Re: parallel vs serial iteration in a "for" loop

2010-06-17 Thread Meikel Brandmeyer
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 this using a > Clojure loop construct? user=> (map vector [:a :b :c :d :e]

Re: Enhanced Primitive Support

2010-06-17 Thread Antony Blakey
On 18/06/2010, at 2:26 PM, David Nolen wrote: > On Fri, Jun 18, 2010 at 12:24 AM, Antony Blakey > wrote: > > That's fine for fact, but as a consumer of library functions, how do I know > when I should pass in bigints? How do I know when an intermediate value, for > my particular combination

Re: Enhanced Primitive Support

2010-06-17 Thread Richard Newman
... which, I acknowledge, might be very hard work, possibly involving every such function having 2 polymorphic variants, one generic boxed form and one unboxed form, automatically selected and call-site-cached like OO dispatch. That's pretty much what Common Lisp compilers do. The compiler

Re: Enhanced Primitive Support

2010-06-17 Thread Mark Engelberg
Hmmm, here's an idea: How about inside of a static function with type annotations, all literals are automatically converted into long and doubles, otherwise behavior stays the same. So: (defn ^:static fib ^long [^long n] (if (<= n 1) 1 (+ (fib (dec n)) (fib (- n 2) is automatically co

Re: Enhanced Primitive Support

2010-06-17 Thread Mark Engelberg
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 literals, you get: (defn ^:static fib ^long [^long n] (

Re: Enhanced Primitive Support

2010-06-17 Thread Richard Newman
I don't want to commit to a full-fledged response on this issue (yet), but: On the other hand, the mental burden for someone who wants BigInts in the new system is very low - you'll get a trivial to track exception. Assuming that I understand your implication (that ArithmeticExceptions

Re: Enhanced Primitive Support

2010-06-17 Thread Jason Wolfe
At first read this all looks awesome to me, and I'd love to see prim/ num/equals in 1.2! Type hinting math has been a pain, I rarely need bigints and would be happy being explicit about them when I do, and I can't think of obvious cases where I'd need (equals? [2.0] [2]), which I gather will no lo

Re: Enhanced Primitive Support

2010-06-17 Thread David Nolen
On Fri, Jun 18, 2010 at 12:24 AM, Antony Blakey wrote: > > That's fine for fact, but as a consumer of library functions, how do I know > when I should pass in bigints? How do I know when an intermediate value, for > my particular combination of parameter values, is going to overflow? > If the lib

Re: Enhanced Primitive Support

2010-06-17 Thread Antony Blakey
On 18/06/2010, at 12:30 PM, Rich Hickey wrote: > You raise several points, I'll take them in turn. First, things are not as > dire as you state. Certainly one could write a version of fact that hardwired > bigints as you showed. But you need not - here's the original naive > definition: > > (

Re: Enhanced Primitive Support

2010-06-17 Thread Daniel Gagnon
> > The problem is that it distinctly *not* easy to write fast numeric code in > Clojure. It requires expert Clojure knowledge. On the other hand, the mental > burden for someone who wants BigInts in the new system is very low - you'll > get a trivial to track exception. > > Also, when done, it do

Re: Enhanced Primitive Support

2010-06-17 Thread David Nolen
On Thu, Jun 17, 2010 at 11:57 PM, 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

Re: Leiningen documentation review?

2010-06-17 Thread Phil Hagelberg
On Thu, Jun 17, 2010 at 5:34 AM, Rick Moynihan wrote: > I read through both the tutorial and the readme, and both seem to be > pretty clear (though I'm not a new user).  They're certainly an > improvement on what came before, and it seems to be a pretty solid > introduction.  Perhaps though, there

Re: Leiningen documentation review?

2010-06-17 Thread Phil Hagelberg
On Thu, Jun 17, 2010 at 4:24 AM, Manfred Lotz wrote: > I had a problem with lein that it did not compile all of my files and > after quite a while I discovered that I had to tell lein about it in > projects.clj by adding a :namespaces statement. > > Well, don't know if this is the intended solutio

Re: Enhanced Primitive Support

2010-06-17 Thread Mark Engelberg
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=> (fact 40) java.lang.ArithmeticException: integer overflow

Re: Enhanced Primitive Support

2010-06-17 Thread David Nolen
On Thu, Jun 17, 2010 at 11:00 PM, Rich Hickey wrote: > In the end, this does put the interests of two sides of the community at > odds. Only one set of interests can be the default. Part of the point of > this discussion is to measure the sides (so speak up people!). I am squarely on the side o

Re: Enhanced Primitive Support

2010-06-17 Thread Rich Hickey
On Jun 17, 2010, at 9:55 PM, Mark Engelberg wrote: It's great to be discussing the possibility of enhanced primitive support. I like most of the proposals. But this part troubles me: # For bigints, specify bigints * new literal bigint format 42N # bigints contagious, no more auto-reduct

Re: Enhanced Primitive Support

2010-06-17 Thread Mark Engelberg
It's great to be discussing the possibility of enhanced primitive support. I like most of the proposals. But this part troubles me: # For bigints, specify bigints * new literal bigint format 42N # bigints contagious, no more auto-reductions * (\+ 0N 21 21) => 42N One of the big reasons

Re: parallel vs serial iteration in a "for" loop

2010-06-17 Thread viksit
Sean, On Jan 10, 12:29 pm, Sean Devlin wrote: > Conrad, > What's your use case that requires for and not map?  I haven't seen > something like this yet, and you've got my curious. Stumbled across this thread after looking for some CL loop equivalents. For instance in CL, the loop macro provides,

Re: basic help with netbeans/enclojure installation

2010-06-17 Thread Chas Emerick
Indeed, it appears that enclojure and NetBeans 6.9 do not mix well. I've updated the "getting started" wiki page (http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Netbeans_and_Enclojure ) with a note to reflect this, and point directly at the 6.8 download page. FYI, there is a

Re: Miscellaneous noob questions

2010-06-17 Thread Peter Schuller
> 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? Vars are intended for global data that is not normally modified, except that they can be re-bound thread-locally. http:

Re: Miscellaneous noob questions

2010-06-17 Thread .Bill Smith
Regarding your def question, it never makes sense to use def inside of a function. In Javascript, you might do this: { var a = 1; var b = 2; ...some statements that might use a and b... } Nothing outside of the curly braces can use those definitions of a and b. The let form is a simila

Re: Enhanced Primitive Support

2010-06-17 Thread Rob Lachlan
Ah -- well that makes sense then. Bravo! Rob On Jun 17, 2:15 pm, Rich Hickey wrote: > On Jun 17, 5:10 pm, Rob Lachlan wrote: > > > I think the enhanced support for primitives is fantastic.  I'm looking > > forward to doing more numerical work in clojure. > > > Quibble:  Using a multiple-recurs

Re: Enhanced Primitive Support

2010-06-17 Thread Rich Hickey
On Jun 17, 5:10 pm, Rob Lachlan wrote: > I think the enhanced support for primitives is fantastic.  I'm looking > forward to doing more numerical work in clojure. > > Quibble:  Using a multiple-recursive algorithm for calculating > fibonnaci values. > > user> (defn fib-2 [n] (if (>= n 1) >      

Re: Enhanced Primitive Support

2010-06-17 Thread Rob Lachlan
I think the enhanced support for primitives is fantastic. I'm looking forward to doing more numerical work in clojure. Quibble: Using a multiple-recursive algorithm for calculating fibonnaci values. user> (defn fib-2 [n] (if (>= n 1) (loop [i 0 f0 0 f1 1] (

Re: basic help with netbeans/enclojure installation

2010-06-17 Thread Jared
On Jun 16, 6:29 pm, Lee Spector wrote: > Starting from scratch, both to try it myself and to know what to tell my > students in the fall, when I'll want them all (regardless of background) to > be able to set up a reasonable Clojure environment without hassles. I've > never previously used ne

Miscellaneous noob questions

2010-06-17 Thread Jared
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? Also, since you can use def to change a binding how do I know for sure that some function is not generating side-effects? I mean

Re: Problems with URL params and http-agent

2010-06-17 Thread RandyHudson
You don't want to encode the whole URL, just the keys and values in the query string. Something like this: (defn encode-params [request-params] (let [encode #(URLEncoder/encode (str %) "UTF-8") coded (for [[n v] request-params] (str (encode n) "=" (encode v)))] (apply str (interpose

ICFP 2010 in Clojure

2010-06-17 Thread oyjlsgqtayxaluoi
Hi, I'm in the California bay area and am interested in participating in ICFP 2010, programming exclusively in Clojure. Is anyone in the area interested in participating, collaborating, or learning? Mike -- You received this message because you are subscribed to the Google Groups "Clojure" gro

Re: Problems with URL params and http-agent

2010-06-17 Thread Jim Blomo
On Wed, Jun 16, 2010 at 6:21 PM, Timothy Washington wrote: > Hey all, something very weird happens when trying to use the http-agent. If > I execute a) or b) in a browser, I get the desired result XML. > a) http://RESTful/path/to/xml > b) http://RESTful/path/to/xml?_wrap=no&_query=declare default

Re: Installing labrepl on netbeans 6.8, problem building labrepl project

2010-06-17 Thread Aaron Bedra
I will take a look at this tomorrow morning. Can you please file an issue for it on github? Cheers, Aaron Sent from my iPhone On Jun 17, 2010, at 9:11 AM, Filipe M R wrote: Hello everybody! I followed the instructions given...everything ok till when I try to build the labrepl project, i

clojure.contrib.logging in "side-effect free" functions?

2010-06-17 Thread William Wadsworth
Hi. I have just started learning Clojure and I am really enjoying myself. However, I am still getting to grips with the workings of its concurrency model, so please excuse me if my question seems too obvious. I have some code that reads data from a file, parses it and generates a CSV file. The fl

Re: working with agents and atoms - a beginner question

2010-06-17 Thread Ryan Waters
After reading your posts and thinking "wouldn't it be nice to just kick off a thread and not care about the return value" I recall Rich using/liking [1] the Java Executor framework [2]. I looked at clojure.lang.Agent and saw it used there, too. It's tricky because I wouldn't want to lean on Java

Enhanced Primitive Support

2010-06-17 Thread Rich Hickey
I've been doing some work to enhance the performance, and unify the semantics, of primitives, in three branches. I've started to document this work here: https://www.assembla.com/wiki/show/clojure/Enhanced_Primitive_Support Feedback welcome, Rich -- You received this message because you are su

Re: Gwt-Clojure - lightweight browser implementation

2010-06-17 Thread Laurent PETIT
Hi, Seems real interesting ! What I was not able to understand by reading your blog post, is which subset of clojure you ported to the client side ? Is it just a declarative API for the widgets part, or will it be possible, as with GWT java client side code, to embed logic,etc ? will it be pos

Installing labrepl on netbeans 6.8, problem building labrepl project

2010-06-17 Thread Filipe M R
Hello everybody! I followed the instructions given...everything ok till when I try to build the labrepl project, it builds till 37% and then stops with this output [ERROR]Transitive dependency resolution for scope: compile has failed for your project. [ERROR]Error message: Failed to resolve artif

Re: Gwt-Clojure - lightweight browser implementation

2010-06-17 Thread pfisk
I will release an open source version of Gwt-Clojure next week. My approach to building web applications is based on "frame technology" which has been used commercially in mainframe code generation for nearly 30 years. You build a library of data structures (frames) that describe an application an

Re: Leiningen documentation review?

2010-06-17 Thread Rick Moynihan
Hi Phil, I read through both the tutorial and the readme, and both seem to be pretty clear (though I'm not a new user). They're certainly an improvement on what came before, and it seems to be a pretty solid introduction. Perhaps though, there should be some mention of how the clojure and contri

Re: basic help with netbeans/enclojure installation

2010-06-17 Thread Lee Spector
Thanks all. I've now installed NetBeans 6.8 and modulo a couple of update cycles on components everything went smoothly and I'm now running NetBeans/Enclojure. Perhaps the getting started instructions ought to include a comment about the required NetBeans version. -Lee On Jun 17, 2010, at

Re: Leiningen documentation review?

2010-06-17 Thread Craig Andera
> Mostly I'd like feedback on the tutorial: > http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md This sentence: "Libraries for the JVM are packaged up as .jar files, which are basically just .zip files with a little extra JVM-specific metadata that contain either .class files (byteco

Re: Leiningen documentation review?

2010-06-17 Thread Manfred Lotz
Hi Phil, On Wed, 16 Jun 2010 21:24:55 -0700 Phil Hagelberg wrote: > I'm pushing for a Leiningen 1.2.0 release really soon now, and part of > that effort is sprucing up the documentation. I've revamped the readme > and added a tutorial for folks just getting started. Of course, > self-editing is

Re: Leiningen documentation review?

2010-06-17 Thread Craig Andera
> 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 Unnecessary (and ironic! :)) repetition of the word "around" in this sentence: If you use Ant, you end up copying around a lot of the same tasks around b