13th June 2008, 10:10 am
Browsing the web today I found an interesting poster about programming paradigms. Interestingly, it puts Java right there with OCaml in the state + closures section, and Java does not have closures. But since there is no OOP in the poster, I assume the author is equaling closures to objects, which according to some is very wise.
6th June 2008, 07:20 pm
As part of my Lisp studies, I have implemented a toy Scheme interpreter in roughly 1000 lines of Lua. It is here. It supports tail-call optimisation, lexical scope for closures, and first-class continuations via call/cc.
I have departed from the traditional approach of implementing a Scheme interpreter in Scheme itself because I wanted to avoid possible confusions between the defined language and the defining language. This has made a lot of the concepts clearer. The evaluator is written in continuation-passing style, which is easily done in Lua because the latter has tail-call optimisations. This way it is easier to reify continuations to first-class values.
I have also added a few primitives to allow me to run some examples, as the factorial and fibonacci functions. More primitives can be easily added if desired.