Scriptjure and JavaScript/Scheme

23 Nov 2009 | By Alex Young | Tags lisp javascript clojure

Scriptjure is an interesting project for those of you who like Clojure. It generates JavaScript like this:

(js (alert "hello world")) 
=> "alert(\"hello world\")"

(js (foo x y)) 
=> "foo(x, y)"

(js (if (== foo 3) (foo x) (bar y)))
=> "if ( (foo == 3) ) {
   foo(x);
   }
   else {
   bar(y);
   }"

Other related projects that are worth looking at are Lisp in JavaScript and Parenscript.

This reminded me of The Little JavaScripter which was an interesting essay by Douglas Crockford, based on The Little LISPer. If you’ve heard people saying Scheme and JavaScript are related but aren’t sure what this means, it’s worth reading it. Google Books has a viewable version of The Littler Schemer so you can follow along.


blog comments powered by Disqus