Tuesday, 13 February 2007

Structure and Interpretation of Computer Programs

This is a famous book that introduces the reader to computer programming using the Scheme language (a simplified dialect of Lisp).

Chris Rathman has been kind enough to upload translations of the code in the book to various other languages, including OCaml:

http://www.codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages

The original code mimicked many unwanted features of the Scheme code (particularly sources of run-time error). As Chris is not an expert ML programmer and was having trouble with some of the examples, I decided to lend a helping hand and rewrite much of the code in more idiomatic OCaml.

Although the final two chapters cover the metacircular evaluator (Lisp's EVAL function that was stripped from ML in order to implement static typing) I think the first three chapters present a good opportunity to show how ML can be more concise, expressive, robust and efficient than Lisp the rest of the time.

Cheers,
Jon.

No comments: