Wednesday, May 03, 2006

Scheme in JavaScript

Someone implemented the Scheme Programming Language in JavaScript. It's done so well, how could I not blog it?

Not only, is most of the core language implemented, but the author also implemented a lightweight threading system that includes message passing. Dang, that's cool.

Is it useful? Well, perhaps with the right examples, it could be a good tool for learning Scheme. You could probably get through most of SICP using what's provided. And if you don't now anything at all about programming, you could use this page as a way to get through HTDP.

I suppose it would allow you to write your JavaScript in Scheme, and who wouldn't want to do that?


  1. A neat trick would be to integrate it with a Scheme web server like SISCweb and have the server decide when to run the Scheme code. On the client or on the server depending on the needs,

    You could have validation for example written in Scheme. The code runs on the client browser to validate input fields. The same code runs on the server to do server side validation.

    Or maybe use Comet (pushing events from the server to the browser) to set up a message passing channel and allow the server to send messages to the client using the concurrency system and vice versa.

    Lotsa cool stuff to play around with :)

  2. Chris,

    You bring up a really good point.

    I'm a big fan of SISCweb, and one of the reasons why, is because of the equivalence between markup and code.

    In other words, I don't need to decide what is HTML or XML vs. what's code. (Or in Java speak: what is a tag file and what is a Java class.)

    If I had an extension like this for JavaScript, then I could dispense with the distinction between server side code and client side code. Which would no doubt be a further win.

    Definitely a cool concept and one worth playing with.