Re: clojure vs scala

2009-08-26 Thread Konrad Hinsen
On 26 Aug 2009, at 22:09, Jon Harrop wrote: >> That is true in principle, but integrating Lisp-style macros and >> compulsory static typing (as opposed to optional type hints) into the >> same language does require some careful thought. I haven't seen >> such a >> combination yet... > > I'm not

Re: Connection pool with clojure.contrib.sql

2009-08-26 Thread Stephen C. Gilardi
On Aug 27, 2009, at 12:37 AM, ngocdaothanh wrote: As I understand clojure.contrib.sql's with-connection opens DB connection at the beginning and closes it at the end of each call. That's correct. How do I create a connection pool so that with-connection can reuse connections? clojure.cont

Re: clojure vs scala

2009-08-26 Thread Luc Prefontaine
We looked at Scala in summer 2008... we were very tired of data typing in general and OOP (specifically Java). We did not find any comfort in Scala regarding these aspects. Concurrencent processing in Scala did not enthusiast us either. We wanted a significant code compression factor compared to e

Re: Why doesn't regex implement ifn?

2009-08-26 Thread Timothy Pratley
> Granted, this wouldn't work for anything that gets passed to Java, but > the following gist would be a start. > http://gist.github.com/176032 You already have a getPattern method for those cases. Which suggests another solution: (defn re-fn "Uses ss to construct a java.util.Pattern. Return

Connection pool with clojure.contrib.sql

2009-08-26 Thread ngocdaothanh
Hi. As I understand clojure.contrib.sql's with-connection opens DB connection at the beginning and closes it at the end of each call. How do I create a connection pool so that with-connection can reuse connections? Thanks, Ngoc. --~--~-~--~~~---~--~~ You received

Re: clojure vs scala

2009-08-26 Thread e
> For instance, after having read odersky's Scala book. . . if you like > static typing and are looking for a new language, I don't see why you > would choose Scala over Haskell unless you have a strong investment in > java or really like the Lift web framework. Unrestricted use of vars, > for ins

Re: Why doesn't regex implement ifn?

2009-08-26 Thread Sean Devlin
Well, with a statically typed language this would be a problem. What if we used duck-typing to get around this? Granted, this wouldn't work for anything that gets passed to Java, but the following gist would be a start. http://gist.github.com/176032 Now, We'd still have to address Mr. Pratley'

Re: clojure vs scala

2009-08-26 Thread e
> > Listed as a downer for Scala: "Functional programming can be difficult > to understand for a Java developer" - same can be said for Clojure, so > I think it is a similarity but he presents it as a difference. > Wow. All the more reason for a Java developer to mess with it then! After all, Ja

Re: Why doesn't regex implement ifn?

2009-08-26 Thread Rich Hickey
On Aug 26, 9:46 pm, Timothy Pratley wrote: > > java.util.regex.Pattern > > I imagine a wrapper class could be returned instead that implemented > IFn and Pattern, Unfortunately, Pattern is a final class. Rich --~--~-~--~~~---~--~~ You received this message beca

Re: clojure vs scala

2009-08-26 Thread e
On Wed, Aug 26, 2009 at 1:18 AM, ngocdaothanh wrote: > > I think there are a lot of people who need to choose between Clojure > and Scala to study as a "new" language. I must say that both are bad: > * Clojure doc is hard to understand. > * Scala grammar is complicated. > > I prefer Clojure. I thi

Re: Why doesn't regex implement ifn?

2009-08-26 Thread Chas Emerick
On Aug 26, 2009, at 9:46 PM, Timothy Pratley wrote: >> java.util.regex.Pattern > > I imagine a wrapper class could be returned instead that implemented > IFn and Pattern, Pattern is a final concrete class, so that's not possible. ...I'm counting down until I see an all-clojure regex implementa

Re: Getting .NET Version of Clojure to run

2009-08-26 Thread David Miller
Having this in hand would be awesome. -David On Aug 26, 3:29 pm, rodgertq wrote: > I'll also execute a CA and contribute back the require build script > changes as well :) > > On Aug 26, 3:26 pm, rodgertq wrote: > > > This can be done by MSBuild directly without involving an external > > tool

Re: Why doesn't regex implement ifn?

2009-08-26 Thread Timothy Pratley
> java.util.regex.Pattern I imagine a wrapper class could be returned instead that implemented IFn and Pattern, but which function would it call? (re-find m) (re-find re s) (re-groups m) (re-matcher re s) (re-matches re s) (re-pattern s) (re-seq re s) I don't think there is a clear implicit choi

Re: Newbie Eclipse REPL question

2009-08-26 Thread Seth.Powsner
On Aug 24, 12:22 pm, Laurent PETIT wrote: > There's a simpler way : just invoke "Run as clojure REPL" on the project > node in the project explorer, and you will have a new Launch configuration > created with the name of the project (and it will, obviously, be launched as > well and available

Re: Why doesn't regex implement ifn?

2009-08-26 Thread Chas Emerick
On Aug 26, 2009, at 9:17 PM, Sean Devlin wrote: > Okay, I'm sure this has come up before. I was just wondering if > anyone knew why the regex literal doesn't implement IFn? > > At first glance it seems like the following would be useful: > > user=>(#"\d{3}" "123") > true > > This is defined as..

Re: How about write clojure code like python mode?

2009-08-26 Thread Jonathan Smith
its not impossible, it just isn't terribly useful. On Aug 26, 6:04 pm, Laurent PETIT wrote: > "they didn't know it was impossible so they did it" :) > > 2009/8/26 Stuart Sierra > > > > > On Aug 24, 11:23 pm, wangzx wrote: > > > I think clojure may mix both the parenthese and python-like indent

Why doesn't regex implement ifn?

2009-08-26 Thread Sean Devlin
Okay, I'm sure this has come up before. I was just wondering if anyone knew why the regex literal doesn't implement IFn? At first glance it seems like the following would be useful: user=>(#"\d{3}" "123") true This is defined as... user=>(not (nil? (re-matches #"\d{3}" "123"))) true What am I

Re: How about write clojure code like python mode?

2009-08-26 Thread Laurent PETIT
"they didn't know it was impossible so they did it" :) 2009/8/26 Stuart Sierra > > On Aug 24, 11:23 pm, wangzx wrote: > > I think clojure may mix both the parenthese and python-like indent > > together. > > This has been attempted about every six months ever since Lisp was > invented. It never

Re: ANN: clojure-maven-plugin 1.0 released and in maven central

2009-08-26 Thread Rob Wolfe
ngocdaothanh napisał(a): > I'm new to Maven. Thank you for the explanation. > > Using git-submodules and is a good idea. Prior to > using your plugin, I use clojure and clojure-contrib with Maven like > this: > > 1. Manually download from GitHub and compile clojure and clojure- > contrib. > 2.

Re: Getting .NET Version of Clojure to run

2009-08-26 Thread rodgertq
I'll also execute a CA and contribute back the require build script changes as well :) On Aug 26, 3:26 pm, rodgertq wrote: > This can be done by MSBuild directly without involving an external > tool like xcopy or robocopy using Item groups and built-in MSBuild > tasks.  We do this to deliver fin

Re: Getting .NET Version of Clojure to run

2009-08-26 Thread rodgertq
This can be done by MSBuild directly without involving an external tool like xcopy or robocopy using Item groups and built-in MSBuild tasks. We do this to deliver final artifacts in our build system. I should have some time in the next day or two to dig into the build for ClojureCLR, I will post

Re: A little help needed in understnding anonymous functions

2009-08-26 Thread Scott Moonen
Hi Soura. I think you have an extra set of parentheses in your second example, on the line with dosync. It should read: (defn foo2 [n] (let [r (ref n)] #(dosync (alter r + %) @r))) -- Scott On Wed, Aug 26, 2009 at 2:40 PM, Sourav wrote: > > Hi, > > I'm new to clojure and came fr

Re: How about write clojure code like python mode?

2009-08-26 Thread Stuart Sierra
On Aug 24, 11:23 pm, wangzx wrote: > I think clojure may mix both the parenthese and python-like indent > together. This has been attempted about every six months ever since Lisp was invented. It never caught on. -SS --~--~-~--~~~---~--~~ You received this messa

Re: clojure vs scala

2009-08-26 Thread Mark Volkmann
On Wed, Aug 26, 2009 at 3:37 PM, Jon Harrop wrote: > > What does "Very clever immutable datastructures" mean? How are Clojure's any > more "clever" than the next implementation? My guess is that he was referring to how the data structures in Clojure are immutable and persistent (meaning that one

Re: A little help needed in understnding anonymous functions

2009-08-26 Thread Emeka
(defn foo2 [n] (let [r (ref n)] #(dosync (alter r + %) @r))) Something went wrong, I am resending the code. Regards, Emeka --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: A little help needed in understnding anonymous functions

2009-08-26 Thread Emeka
On Wed, Aug 26, 2009 at 6:40 PM, Sourav wrote: > > Hi, > > I'm new to clojure and came from a Lisp background. While learning I > clojure I came accross the two different ways of creating anonymous > functions ((fn ...) and #(...)). I tried to construct the accumulator > function in clojure using

Re: clojure vs scala

2009-08-26 Thread Jon Harrop
On Tuesday 25 August 2009 21:43:56 npowell wrote: > On Aug 25, 4:36 pm, Christian Vest Hansen > > wrote: > > I think he misrepresents both Scala and Clojure. > > ... > > Not a super helpful assessment. > > I'd like to hear more. What do you disagree with and why? I think most of the article was

Re: A little help needed in understnding anonymous functions

2009-08-26 Thread Meikel Brandmeyer
Hi, Am 26.08.2009 um 20:40 schrieb Sourav: (defn foo2 [n] (let [r (ref n)] #((dosync (alter r + %) @r One pair of parentheses too much... (defn foo2 [n] (let [r (ref n)] #(dosync (alter r + % What you wrote is #((foo)) which translates to (fn [] ((

Re: On the reader macro #=

2009-08-26 Thread Chouser
On Wed, Aug 26, 2009 at 1:13 PM, John Harrop wrote: > This is important to know about for security reasons, also. Specifically, if > you are receiving Clojure data structures in text form over the network, and > don't set *read-eval* to false, you're vulnerable to a "Clojure injection > attack". S

A little help needed in understnding anonymous functions

2009-08-26 Thread Sourav
Hi, I'm new to clojure and came from a Lisp background. While learning I clojure I came accross the two different ways of creating anonymous functions ((fn ...) and #(...)). I tried to construct the accumulator function in clojure using these forms and this is what I wrote (this might seem naive

Re: clojure vs scala

2009-08-26 Thread Jon Harrop
On Wednesday 26 August 2009 04:37:58 Alan Busby wrote: > On Wed, Aug 26, 2009 at 5:43 AM, npowell wrote: > > I mean, I didn't think the article was terribly in depth, but a real, > > evenhanded comparison would be enlightening. > > Reducing it further, I'd be interested just to hear more about th

Re: clojure vs scala

2009-08-26 Thread Jon Harrop
On Wednesday 26 August 2009 08:35:49 Konrad Hinsen wrote: > On 26 Aug 2009, at 07:06, Vagif Verdi wrote: > > I fail to see how macros can be contrasted to static typeng. They are > > orthogonal. > > That is true in principle, but integrating Lisp-style macros and > compulsory static typing (as opp

Re: Getting .NET Version of Clojure to run

2009-08-26 Thread Rich Hickey
On Aug 26, 11:42 am, Shawn Hoover wrote: > On Sat, Aug 15, 2009 at 8:36 AM, David Miller wrote: > > Clojure.Compile is just for AOT-compilation.  It will compile whatever > > libs are on the command line.  As you state, it is used to bootstrap, > > i.e. compile core.clj and the rest of the boo

Re: On the reader macro #=

2009-08-26 Thread John Harrop
This is important to know about for security reasons, also. Specifically, if you are receiving Clojure data structures in text form over the network, and don't set *read-eval* to false, you're vulnerable to a "Clojure injection attack". Someone could send you "(+ 5 #=(System/exit 0))" as a denial-o

Re: On the reader macro #=

2009-08-26 Thread John Harrop
On Wed, Aug 26, 2009 at 1:13 PM, John Harrop wrote: > This is important to know about for security reasons, also. Specifically, > if you are receiving Clojure data structures in text form over the network, > and don't set *read-eval* to false, you're vulnerable to a "Clojure > injection attack".

Re: we offer cheap sport shoes men's shoe(www.salegood8.com) casual shoe fashion shoe

2009-08-26 Thread John Harrop
On Tue, Aug 25, 2009 at 11:42 AM, Chouser wrote: > > On Tue, Aug 25, 2009 at 10:36 AM, John Harrop wrote: > > What the hell? > > The group actually gets a steady stream of spam, but it > usually gets deleted instead of being sent to everyone. On > this one I accidentally clicked the wrong button

Re: Getting .NET Version of Clojure to run

2009-08-26 Thread Shawn Hoover
On Sat, Aug 15, 2009 at 8:36 AM, David Miller wrote: > Clojure.Compile is just for AOT-compilation. It will compile whatever > libs are on the command line. As you state, it is used to bootstrap, > i.e. compile core.clj and the rest of the bootstap clojure code into > assemblies, which can then

Re: clojure vs scala

2009-08-26 Thread CuppoJava
I didn't find that article particularly helpful, especially since I was facing the exact same decision just a year ago. For me, the difficulty of the language was the ultimate criteria I made me go with Clojure. Relative to Scala, Clojure is quite a bit easier to pickup. It has less syntax rules

Re: clojure vs scala

2009-08-26 Thread cody koeninger
On Aug 26, 5:29 am, Christian Vest Hansen wrote: > Another Scala downer: "Scala is very powerful, some developers might > shoot themselves into the foot" - I don't see how this applies more to > Scala than Clojure. If we want to talk about foot-shooting, we could > talk about macros. There are

Re: clojure vs scala

2009-08-26 Thread ngocdaothanh
> In the meantime this may be helpful: > http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Example... Thank you, this is very helpful. > > * Clojure doc is hard to understand. > > Have you seen http://ociweb.com/mark/clojure/article.html? Yes I have, this may be the best Clojure doc

Re: ANN: clojure-contrib automatic documentation system "complete"

2009-08-26 Thread Rich Hickey
On Tue, Aug 25, 2009 at 4:39 PM, Tom Faulhaber wrote: > > Rich: > > Glad to help, thanks for the kind words. > > For Clojure core, mostly what I need to do is refactor and > parameterize a bunch of stuff. I'll just make a fork and start > playing. When I have something, we can discuss and fine tun

Re: clojure vs scala

2009-08-26 Thread Mark Volkmann
On Wed, Aug 26, 2009 at 12:18 AM, ngocdaothanh wrote: > > I think there are a lot of people who need to choose between Clojure > and Scala to study as a "new" language. I must say that both are bad: > * Clojure doc is hard to understand. Have you seen http://ociweb.com/mark/clojure/article.html?

Re: Jwt from Clojure?

2009-08-26 Thread rb
On Aug 17, 6:17 pm, Adrian Cuthbertson wrote: > Hi Raphaël, > > If you're going to drive your app (and server) from clojure, then you > can use Compojure's jetty.clj module. This allows you to create a Thanks Adiran for this information. It has allowed me to get it running quite easily. I've

Re: duck-streams example?

2009-08-26 Thread Michael Kohl
On Tue, Aug 25, 2009 at 5:51 PM, Michael Kohl wrote: > The main problem is that I can't > seem to figure out how to use duck-streams to achieve what I want... #clojure for the rescue. replaca pointed me to the documentation of clojure.contrib.http.agent which has a nice example for what I wanted

Re: clojure vs scala

2009-08-26 Thread Sean Devlin
Quick aside: There is now a doc directory in contrib, specifically for usage docs. There should be more examples coming in the future. On Aug 26, 1:18 am, ngocdaothanh wrote: > I think there are a lot of people who need to choose between Clojure > and Scala to study as a "new" language. I mus

Re: clojure vs scala

2009-08-26 Thread Christian Vest Hansen
On Tue, Aug 25, 2009 at 10:43 PM, npowell wrote: > > On Aug 25, 4:36 pm, Christian Vest Hansen > wrote: >> I think he misrepresents both Scala and Clojure. > > ... > > Not a super helpful assessment. > > I'd like to hear more.  What do you disagree with and why? Listed as a downer for Scala: "Fu

Re: clojure vs scala

2009-08-26 Thread Michael Wood
2009/8/26 Konrad Hinsen : > > On 26 Aug 2009, at 07:06, Vagif Verdi wrote: [...] >> Here's and example of statically typed language (liskell) >> with lisp syntax and full blown lisp macros: >> http://blog.clemens.endorphin.org/2009/01/liskell-standalone.html > > ...this site is down at the moment.

Re: advice needed about macro for proxy with argument

2009-08-26 Thread rb
> > > It takes as arguments > > > * the list of interfaces it implements (currently necessary for > > >http://www.assembla.com/spaces/clojure/tickets/181) > > > ?? You always have to specify the interfaces, no? > > What I meant is that if I always implement SignalX$Listener, I could > even get ri

Re: advice needed about macro for proxy with argument

2009-08-26 Thread rb
On Aug 25, 9:54 pm, Meikel Brandmeyer wrote: > Hi, > > Am 25.08.2009 um 20:09 schrieb rb: > > > Here is what I've done for now: > > > (defmacro deflistener [ interfaces trigger-args & body] > >  `(proxy [ ~...@interfaces ] [] (trigger [...@trigger-args] ~...@body)) > > ) > > > Which can be used

Re: clojure vs scala

2009-08-26 Thread Konrad Hinsen
On 26 Aug 2009, at 07:06, Vagif Verdi wrote: > I fail to see how macros can be contrasted to static typeng. They are > orthogonal. That is true in principle, but integrating Lisp-style macros and compulsory static typing (as opposed to optional type hints) into the same language does require