Re: Local bindings w/o let

2011-07-11 Thread Michael Wood
On 11 July 2011 03:42, Luc Prefontaine wrote: > Lets try to clear the confusion a bit here: > > (def max1 [x] x) > (def max2 [x y] (if (> x y) x y)) > (def max3 ([x y & more] (reduce max (max x y) more))) > > The above a three different fns. To be even more clear, the above should be: (defn max1

Re: Native compiler on Clojure

2011-07-11 Thread Philipp Meier
On 11 Jul., 00:26, cran1988 wrote: > Did anyone started creating native compiler for Clojure language ? Do you mean a compiler which emits native code or do you mean a compiler written in clojure emitting java byte code? -billy. -- You received this message because you are subscribed to the Go

Too many arguments to if

2011-07-11 Thread Antonio Recio
I get the error "Too many arguments to if" with this. Do you have any suggestion? (defn make-tree [tree [n1 n2 n3 n4]] (.addItem tree n1) (if (empty? n2) (.setChildrenAllowed tree n1 false) (doto tree (.addItem n2) (.setParent n2 n1) (.expandItemsRecursively n1))

Re: Too many arguments to if

2011-07-11 Thread Tassilo Horn
Antonio Recio writes: Hi Antonio, > I get the error "Too many arguments to if" with this. Do you have any > suggestion? `if' expects exacly one test, one then-form, and one else-form. Your first and second `if' contain two forms in else. You have to wrap them in a `do'. --8<---cu

a lazy version of shuffle.

2011-07-11 Thread Sunil S Nandihalli
Hello everybody, I think a lazy version of shuffle would be a good addtion to the core. I tried googling for one and found http://ytakenaka.blogspot.com/2011/05/lazy-shuffle-clojure.html which was infact slower than original shuffle and was unable to reproduce the performance claims made there in.

Re: a lazy version of shuffle.

2011-07-11 Thread Tassilo Horn
Sunil S Nandihalli writes: Hi Sunil, > I think a lazy version of shuffle would be a good addtion to the > core. I tried googling for one and found > http://ytakenaka.blogspot.com/2011/05/lazy-shuffle-clojure.html which > was infact slower than original shuffle and was unable to reproduce > the

Re: a lazy version of shuffle.

2011-07-11 Thread Sunil S Nandihalli
yea true, the full sequence has to be realized before it is shuffled .. but however the thing is that I am only interested in the first couple of elements of the shuffled sequence. That is the lazy part I am talking about. But I guess I won't be winning much there.. And again, I think I would have

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread mike.w.me...@gmail.com
Ken Wesson wrote: >On Wed, Jul 6, 2011 at 4:30 AM, Michael Wood >wrote: >> On 6 July 2011 10:14, Ken Wesson wrote: >>> Sorry, but I think version control and, particularly, dealing with >>> edit collisions is not something you can solve as easily as just >>> slapping a lock onto each file acces

Re: Native compiler on Clojure

2011-07-11 Thread Bronsa
i think he means clojure in clojure Il giorno 11/lug/2011 12.12, "Philipp Meier" ha scritto: > On 11 Jul., 00:26, cran1988 wrote: >> Did anyone started creating native compiler for Clojure language ? > > Do you mean a compiler which emits native code or do you mean a > compiler > written in cloju

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread Ken Wesson
On Sun, Jul 10, 2011 at 2:01 AM, mike.w.me...@gmail.com wrote: [snip most of post whose sole purpose seems to be to gainsay anything I write] > The only source control system I know that uses an ACID database doesn't > need a back end server. How exactly is this possible? Databases *are* servers

Re: a lazy version of shuffle.

2011-07-11 Thread Tassilo Horn
Sunil S Nandihalli writes: Hi Sunil, > yea true, the full sequence has to be realized before it is shuffled > .. but however the thing is that I am only interested in the first > couple of elements of the shuffled sequence. Well, in that case, you can use the standard shuffle, right? For examp

Odp: Re: a lazy version of shuffle.

2011-07-11 Thread Daniel Janus
One thing to keep in mind when shuffling is that, by default, if the input sequence is large enough then most permutations can never be generated by shuffle. This follows naturally from the Dirichlet's pigeonhole principle: there are only 2^64 possible seeds (states of the RNG), but (factorial (cou

Re: jdbc and postgresql type problem

2011-07-11 Thread Aaron Bedra
Silly question, but which version of java.jdbc are you using? Up until 0.0.3 I had no end of troubles with psql because of the batchExecute issue. Cheers, Aaron Bedra -- Clojure/core http://clojure.com On 07/11/2011 02:48 AM, Brian Carper wrote: On Jul 10, 4:52 pm, Wilfred wrote: I'm at a

Clojure Wiki for general public

2011-07-11 Thread Sergey Didenko
It seems we don't have a *centralized* wiki not just for the Clojure Core developers, but for everybody in our community. Application developers have to look for *broad* info all over different resources. I have just tried Clojure 1.3 and realized I have to google a lot to find answers. - Clo

How to add jar files to leiningen projects?

2011-07-11 Thread finbeu
Hello, I have some external jar libaries that I need to import in my clojure namespace. As I just started to use leinigen, I don't understand how to add them to my project. Let's say the library resides in c:\temp\jars\mylib.jar How do I add this properly to mein leinigen project? (defproject

Re: How to add jar files to leiningen projects?

2011-07-11 Thread Mark Rathwell
To install the jars to your local maven repository (~/.m2): mvn install:install-file -Dfile= -DgroupId= -DartifactId= -Dversion= -Dpackaging= -DgeneratePom=true Where: the path to the file to load the group that the file should be registered under the artifact

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread Alessio Stalla
On 11 Lug, 13:51, Ken Wesson wrote: > On Sun, Jul 10, 2011 at 2:01 AM, mike.w.me...@gmail.com > wrote: > > [snip most of post whose sole purpose seems to be to gainsay anything I write] > > > The only source control system I know that uses an ACID database doesn't > > need a back end server. > >

Re: Clojure Wiki for general public

2011-07-11 Thread Jonathan Cardoso
I feel the same, although Wikibooks is kind of what you need: http://en.wikibooks.org/wiki/Clojure_Programming -- 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 memb

Re: How to add jar files to leiningen projects?

2011-07-11 Thread Vincent
can lein do that ? -- 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 group,

Re: How to add jar files to leiningen projects?

2011-07-11 Thread Mark Rathwell
I haven't seen that it can (doesn't mean it can't though ;). It would seem to be a natural option for the 'lein install' task, to add a three argument option: [path-to-jar project-name version], where project-name is the same as in the two argument version (group-id/artifact-id). - Mark On Mon,

Re: jdbc and postgresql type problem

2011-07-11 Thread Brian Carper
On Jul 11, 6:41 am, Aaron Bedra wrote: > Silly question, but which version of java.jdbc are you using?  Up until > 0.0.3 I had no end of troubles with psql because of the batchExecute issue. I tested Wilfred's code with 0.0.3-SNAPSHOT. --Brian -- You received this message because you are subsc

Re: a lazy version of shuffle.

2011-07-11 Thread Alan Malloy
If the sequence is already realized, or is cheap, and you want only a very small random subset of it, you can do better than shuffling the whole thing. Fliebel and I played around with several solutions to this, some time ago. I can't find the whole thing, but some interesting examples and benchmar

Re: How to add jar files to leiningen projects?

2011-07-11 Thread Alan Malloy
Maven will give you this list of instructions if you just add a dependency to project.clj, and it can't find the required artifact. So write your project.clj as though your external jars were available to maven, and then maven will tell you how to make it available. It's the same as Mark's suggesti

Re: How to add jar files to leiningen projects?

2011-07-11 Thread Phil Hagelberg
Mark Rathwell writes: > I haven't seen that it can (doesn't mean it can't though ;).  It would > seem to be a natural option for the 'lein install' task, to add a > three argument option: [path-to-jar project-name version], where > project-name is the same as in the two argument version > (group-

Reworking :pre condition to add an error message

2011-07-11 Thread Timothy Washington
Note: This message was originally posted by ' Shantanu' on the "*Re: Clojure for large programs*" thread. I took a look at Shantanu's macros, and I like the concept a lot. But I would prefer something baked into the :pre condition itself. The reason is that it just removes a layer of indirection.

Re: Reworking :pre condition to add an error message

2011-07-11 Thread Ben Mabey
On 7/11/11 11:40 AM, Timothy Washington wrote: Note: This message was originally posted by ' Shantanu' on the "*/Re: Clojure for large programs/*" thread. I took a look at Shantanu's macros, and I like the concept a lot. But I would prefer something baked into the :pre condition itself. The

Aw: How to add jar files to leiningen projects?

2011-07-11 Thread finbeu
That was fast. Makes sense. Thanks! - Finn -- 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 unsu

Re: Reworking :pre condition to add an error message

2011-07-11 Thread Timothy Washington
Yes, the :post is easily done as well. I just wanted to throw up a quick proof-of-concept. Tim On Mon, Jul 11, 2011 at 1:52 PM, Ben Mabey wrote: > ** > On 7/11/11 11:40 AM, Timothy Washington wrote: > > Note: This message was originally posted by ' Shantanu' on the "*Re: > Clojure for large p

BDD - Given When Then

2011-07-11 Thread Max Weber
Hi, I like to write some integration/acceptance tests in Clojure. At the moment I'm using cuke4duke (cucumber), but I'm not satisfied with it. For my unit tests I'm already using lazytest. In the acceptance tests I like to apply the typical Given When Then template (like cucumber do). So are there

Aw: Re: How to add jar files to leiningen projects?

2011-07-11 Thread finbeu
Hi Phil, leiningen is really great. I haven't used maven before so I was really scratching my head. Would be great to have an option like this so I don't have to run mvn on the command line. Thanks! - Finn -- You received this message because you are subscribed to the Google Groups "Clojure

Re: Reworking :pre condition to add an error message

2011-07-11 Thread Laurent PETIT
If this could integrate with existing efforts put on validation libraries, plus (optionnally) a way to customize the "rendering" of pre-condition errors, this could be great :-) Maybe just inverting things : if the precondition returns falsy, this could mean that there is no violated precondition.

What's your workflow in IntelliJ IDEA

2011-07-11 Thread finbeu
Hi, I'm using Jetbrains IntelliJ IDEA Community Edition with La Clojure and Leiningen Plug In. I think it is really great, but I have the feeling my workflow is not very efficient, it is a mix of invoking command lines (lein new myproject), then switching to IDEA, running lein commands from the

Re: Tree vaadin?

2011-07-11 Thread Antonio Recio
Harsha Sanjeewa has translated the vaadin example of the tree in clojure. The source is here . It is very useful to begin working with clojure and vaadin. This tree example has 2 levels and I would like to have 4 levels. With the following code it s

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread Ken Wesson
On Mon, Jul 11, 2011 at 11:29 AM, Alessio Stalla wrote: [snip most of another post whose sole purpose seems to be to gainsay anything I write] >> "Database" and >> "DBMS" are used more-or-less synonymously (when "database" isn't used >> more broadly than ACID/SQL/etc.) and the "S" in "DBMS" stands

Re: a lazy version of shuffle.

2011-07-11 Thread Ken Wesson
On Mon, Jul 11, 2011 at 1:13 PM, Alan Malloy wrote: > If the sequence is already realized, or is cheap, and you want only a > very small random subset of it, you can do better than shuffling the > whole thing. Fliebel and I played around with several solutions to > this, some time ago. I can't fin

Re: jdbc and postgresql type problem

2011-07-11 Thread Wilfred
On Jul 11, 7:48 am, Brian Carper wrote: > On Jul 10, 4:52 pm, Wilfred wrote: > > > I'm at a bit of a loss. "UPDATE comments SET approved='1' WHERE id = > > '1'" works fine in psql. approved is a boolean field, so is this an > > issue with the SQL library producing incorrect SQL? > > I think this

Results from 2011 State of Clojure survey

2011-07-11 Thread Chas Emerick
"A few weeks ago, I opened the 2011 State of Clojure survey. As with last year’s survey, my aim was to take a snapshot of the Clojure community — our origins in aggregate, how and where we are using Clojure, and what needs to improve to help the community grow and prosper." The results are in:

Re: Results from 2011 State of Clojure survey

2011-07-11 Thread Timothy Washington
Great work Chas. Although I didn't take the survey, I'm one of those programmers coming from Java. Now I'm trying to transition to full-time Clojure work, usually telling everyone I know to take a look at it. Tim On Mon, Jul 11, 2011 at 5:22 PM, Chas Emerick wrote: > "A few weeks ago, I opened

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread Asim Jalis
On Tue, Jul 5, 2011 at 6:35 AM, Stephen C. Gilardi wrote: > I would argue that the ~/.m2 repository is nearly as easy to work with as any > other local, on-disk scheme one might envision and has the benefit of working > with any maven-compatible tool. > > It also works for arbitrary jars one may

Using Clojure To Debug Java Apps

2011-07-11 Thread Asim Jalis
I have been using the Clojure REPL to debug a large Java server app. It's great for exploratory testing and for validating assumptions about how the system works. I wanted to post the code here in case someone else finds this useful. 1. Stick this in a class that is loaded early in the server/app.

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread Mike Meyer
On Mon, 11 Jul 2011 07:51:33 -0400 Ken Wesson wrote: > On Sun, Jul 10, 2011 at 2:01 AM, mike.w.me...@gmail.com > wrote: > [snip most of post whose sole purpose seems to be to gainsay anything I write] Because in that article, you were (unusual for you) way off base. > > The only source contro

Re: How to add jar files to leiningen projects?

2011-07-11 Thread Shantanu Kumar
I have seen this local JAR thing coming up far too often, so I sat down and wrote this: https://github.com/kumarshantanu/lein-localrepo Can somebody try this and let me know if it works? Regards, Shantanu On Jul 11, 11:35 pm, finbeu wrote: > Hi Phil, > > leiningen is really great. I haven't us

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread Mike Meyer
On Mon, 11 Jul 2011 16:21:45 -0400 Ken Wesson wrote: > > So, "repository" does not imply "server" at all, > This is getting silly. "Repository" is a word that brings immediately > to mind typing checkin and checkout commands at a command prompt in > order to work on source code that is stored remo

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread Shantanu Kumar
On Jul 12, 4:24 am, Asim Jalis wrote: > On Tue, Jul 5, 2011 at 6:35 AM, Stephen C. Gilardi wrote: > > > I would argue that the ~/.m2 repository is nearly as easy to work with as > > any other local, on-disk scheme one might envision and has the benefit of > > working with any maven-compatible

Re: Results from 2011 State of Clojure survey

2011-07-11 Thread Ken Wesson
Nice analysis. A few remarks: * The results seem to confirm the arguments here that there's a problem with documentation and with the lack of a good "starter kit". Making the command line REPL better might help in that regard too (tab completion would not even be too difficult, given Clojure's int

Re: Results from 2011 State of Clojure survey

2011-07-11 Thread Phil Hagelberg
Ken Wesson writes: > * How would you characterize your use of Clojure *today* -- you do > know that HTML supports true italics, right? :) Obviously *today* is meant to be rebound to a new value in the future. -Phil -- You received this message because you are subscribed to the Google Groups "

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread Ken Wesson
On Mon, Jul 11, 2011 at 7:39 PM, Mike Meyer wrote: > On Mon, 11 Jul 2011 07:51:33 -0400 > Ken Wesson wrote: > >> On Sun, Jul 10, 2011 at 2:01 AM, mike.w.me...@gmail.com >> wrote: >> [snip most of post whose sole purpose seems to be to gainsay anything I >> write] > > Because in that article, y

Re: Build tool for mixed Clojure/Java projects

2011-07-11 Thread Ken Wesson
On Mon, Jul 11, 2011 at 7:51 PM, Mike Meyer wrote: > On Mon, 11 Jul 2011 16:21:45 -0400 > Ken Wesson wrote: >> > So, "repository" does not imply "server" at all, >> This is getting silly. "Repository" is a word that brings immediately >> to mind typing checkin and checkout commands at a command p

Re: Results from 2011 State of Clojure survey

2011-07-11 Thread Ken Wesson
On Mon, Jul 11, 2011 at 8:40 PM, Phil Hagelberg wrote: > Ken Wesson writes: > >> * How would you characterize your use of Clojure *today* -- you do >> know that HTML supports true italics, right? :) > > Obviously *today* is meant to be rebound to a new value in the future. ROFL... (doto (Thre

Re: How to add jar files to leiningen projects?

2011-07-11 Thread Phil Hagelberg
Shantanu Kumar writes: > I have seen this local JAR thing coming up far too often, so I sat > down and wrote this: > > https://github.com/kumarshantanu/lein-localrepo > > Can somebody try this and let me know if it works? Did some simple tests on it and it looks like it works fine. Thanks for p

Re: How to add jar files to leiningen projects?

2011-07-11 Thread Mark Rathwell
It works for me on OS X (at least install does), however, it requires you to be in a project directory to use. Not really an inconvenience, but it may not be completely obvious to a user installing with the intention of using the dependency in multiple projects that they won't need to repeat this

Re: How to add jar files to leiningen projects?

2011-07-11 Thread Tarantoga
You can copy your jars in the /lib directory and add the ":disable-implicit-clean true" option to your project.clj file. Leiningen will not delete your jars while building the project. On Jul 11, 6:23 pm, finbeu wrote: > Hello, > > I have some external jar libaries that I need to import in my clo

Ring+Swank

2011-07-11 Thread Tarantoga
Hi all, I'd like to make a web-app to which I could connect using slime and make some changes there while the application is still running. How to start Swank-server from the working Ring-application? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Results from 2011 State of Clojure survey

2011-07-11 Thread Meikel Brandmeyer
Hi, Am Dienstag, 12. Juli 2011 02:36:34 UTC+2 schrieb Ken Wesson: > An argument could be made that Clojure is aimed more at those who do > that sort of "analytical comprehension" than those looking for the > latest jazzy fad, but an argument could also be made that attracting a > broader base is