brew install clojure
How to setup Clojure from scratch
11–20 of 21 posts
Re: How to setup Clojure from scratch
#12I'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
#13What 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…
Generally speaking, I found the following to be true:
Java 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
#14Re: How to setup Clojure from scratch
#15Re: How to setup Clojure from scratch
#16Ok, 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.
* 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
#17What 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…
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 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 magnitu…
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
#18Ok, 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.
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 give…
`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
#19Earlier quoted context omitted.
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 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 magnitu…
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.…
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
#20Earlier quoted context omitted.
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 give…
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.
That's how I implement the exit function in the article.