2008

2007

2006

2005

2004

Robert Zubek: Clojure webserver in sub-hundred LOC

▁ apr 27 2008

Robert Zubek wrote a blogpost on how to write a webserver in Clojure in less than 100 lines of code. Interestingly, he uses Jetty for the actual serving part — interesting because Clojure has an excellent bridge to Java (as it runs on the JVM itself.)

It’s nice to see how you can tie in a Lisp-1 with something as shoddy and sordid as Java itself, and still keep it somewhat elegant.

You have to admit this is darn cute:

user=> (import '(org.mortbay.jetty Server))
nil
user=> (new Server)
Server@1f0f8ff
user=>

Clojure was previously mentioned here.

← Previous: Obscure reference  //  Next: Impressive Canvas

comments

Vetle, 7 months, 1 week ago:

Shoddy and sordid, even! Man, you’re really bringing the hate here… ;)

Vetle, 7 months, 1 week ago:

Btw, perhaps you wouldn’t want to use that web server in Clojure, since it’s written in Java … I mean, since Java is shoddy and sordid.

Just a thought.

=)

Jesper, 7 months, 1 week ago:

I keep forgetting that you’re a Java-man. If it wasn’t obvious from my post, I am expressing why it is interesting that you can bridge an elegant language with something that is written in a less elegant manner. That being Java’s overly verbose syntax. No surprises there.

Don’t take it so personal :-)

Vetle, 7 months, 1 week ago:

You’re the one making it personal now. ;) You know I’m not a “Java-man”, anymore than you’re a “Perl-man”.

Java isn’t too good, but the JRE is very nice, and I used Jython a long time ago. Implementing languages for that instead of making up your own runtime is a great idea, you don’t have to write a gazillion libraries all over again.

powered by