News for hackers. Stuff that matters.
Re:How to setup Clojure from scratch by j_baker on Tuesday July 13, 2010 @11:31AM (#1511637)
Of course, you could also just use cljr: http://github.com/liebke/cljr
Re:How to setup Clojure from scratch by twism on Tuesday July 13, 2010 @12:06PM (#1511760)
Re:How to setup Clojure from scratch by devonrt on Tuesday July 13, 2010 @12:09PM (#1511769)
Leiningen's goals are slightly different than clrj's. Leiningen is more like a Maven type project descriptor/build system whereas cljr is more like an easy_install-esque tool. cljr can be used without creating a project.
Re:How to setup Clojure from scratch by benatkin on Tuesday July 13, 2010 @12:12PM (#1511792)
Yes, but it does have a repl command, and a swank plugin, and I like using it as a virtualenv-type tool even when I'm not working on a project. (And most of the time I am. I find the best way to learn is to attempt to write a real piece of software, and it has the added bonus that I might be able to add something to my portfolio.)
Re:How to setup Clojure from scratch by benatkin on Tuesday July 13, 2010 @12:10PM (#1511777)
Yes, and then you would also be able to install libraries without editing a shell script.
Re:How to setup Clojure from scratch by rclaycoke on Tuesday July 13, 2010 @01:16PM (#1512045)
What is Clojure performance like? I checked with http://shootout.alioth.debian.org and haven't found it there. We're doing some lightweight geometrical computations like figure intersections, etc (queued, not real time) and we built them in JRuby just for fun (JVM is a requirement here) so I'm wondering how would Clojure perform there.

I'm asking here because I don't know a bit of Lisp so I can't just quickly code a benchmark. Thanks!!

Re:How to setup Clojure from scratch by acangiano on Tuesday July 13, 2010 @01:25PM (#1512070)
I tried to convince Isaac to include Clojure in the benchmarks. He will probably include it once Clojure 1.2 (which has implications for performance) is released, provided that all the benchmarks are ready.

Generally speaking, I found the following to be true:

Java < Scala < Clojure < ... < JRuby.

Clojure is relatively fast. It really depends on the program at hand, but in my experience, having to REALLY generalize, it's at least an order of magnitude faster than Ruby/JRuby.

Re:How to setup Clojure from scratch by technomancy on Tuesday July 13, 2010 @05:39PM (#1512859)
Simplistic idiomatic Clojure is much faster than JRuby, but often a bit slower than Java and Scala depending on how much you rely on reflection.

However, if you push it, Clojure can be as fast as anything else on the JVM; it's just a matter of how much time you spend profiling and optimizing. In many cases you can output the exact same bytecode in Clojure that you'd get from a several-times-more-verbose Java program.

An extreme example: http://meshy.org/2009/12/13/widefinder-2-with-clojure.html

Re:How to setup Clojure from scratch by tl on Tuesday July 13, 2010 @08:48PM (#1513222)
$ time echo '(println "Hello, world!")' | clojure

Clojure 1.0.0-

user=> Hello, world!

nil

user=>

real 0m2.756s

user 0m1.040s

sys 0m0.140s

$ time echo 'print "Hello, world!"' | python

Hello, world!

real 0m0.018s

user 0m0.000s

sys 0m0.010s

Beware the horrible startup time for small programs.

Re:How to setup Clojure from scratch by hexidecimal0 on Tuesday July 13, 2010 @12:53PM (#1511958)
Keep it up Antonio! Even though my comment has nothing to do with Clojure, but I just wanted to let you know that I'm very impressed by quality of your average post. You're like Joel Spolsky of Web 2.0 :)
Re:How to setup Clojure from scratch by bphogan on Tuesday July 13, 2010 @01:51PM (#1512165)
Ok, I'm totally a noob with Clojure, but I thought all I had to do was java -jar ~/clojure.jar and I got a REPL. Did something change recently? This seems like an awful lot more work than it should be.
Re:How to setup Clojure from scratch by acangiano on Tuesday July 13, 2010 @02:34PM (#1512307)
java -jar ~/clojure.jar will give you a REPL. It will be a less convenient REPL though. In particular:

* No history support. Try to use the arrow to go back to the previous instruction and you'll be greeted by ^[[A.

* No tab completion.

* No exit function.

* No startup file with your customizations.

* No clojure.contrib automatically in your classhpath.

* No simple way to automatically place a list of jars for a given project in the classpath by simply specifying them in a file.

java -jar ~/clojure.jar will do. But this, I believe, is nicer.

Re:How to setup Clojure from scratch by briancarper on Tuesday July 13, 2010 @07:04PM (#1513036)
You can always exit via (System/exit 0), 0 being the return code.

`java -cp clojure.jar clojure.main` is the preferred method of starting Clojure rather than using -jar, I think.

Re:How to setup Clojure from scratch by acangiano on Wednesday July 14, 2010 @12:02AM (#1513562)
> You can always exit via (System/exit 0), 0 being the return code.

That's how I implement the exit function in the article.

Re:How to setup Clojure from scratch by xpaulbettsx on Tuesday July 13, 2010 @01:52PM (#1512169)
I knew that HN would have an awesome list of resources on this topic, thanks for the info guys!
Re:How to setup Clojure from scratch by adamilardi on Tuesday July 13, 2010 @12:31PM (#1511865)
Is clojure planning to integrate with eclipse? That strikes me as a good way to get new users.
Re:How to setup Clojure from scratch by acangiano on Tuesday July 13, 2010 @12:38PM (#1511891)
Re:How to setup Clojure from scratch by psadauskas on Tuesday July 13, 2010 @12:48PM (#1511945)

    brew install clojure
Re:How to setup Clojure from scratch by demoon on Tuesday July 13, 2010 @01:10PM (#1512027)
Hm.. Did you read the article? It's written for folks who want to know how everything works and what things are composed of.
Re:How to setup Clojure from scratch by goodbadwolf on Wednesday July 14, 2010 @12:20AM (#1513589)
Well, you start from inventing the Universe