Sonntag, 27. Mai 2012

Porting PAIP to clojure - Introduction

What is PAIP?

PAIP stands for Paradigms of Artificial Intelligence Programming and is a book written by Peter Norvig.

It is wiedly seen as one of the best programming books and it is definitly the book to read if you are interesting in lisp and AI - like I am.

The best of this book is that the programs are really developed. Norvig doesn't give the complete and bug-free implementation of the examples, but he shows the process of writing the programs: starting from a simple description to a minimal implementation - then showing limitations of the programs and how to resolve them. This makes the book a great programming book in general.

Porting PAIP to clojure

After reading the first few chapters I decided to give me a challenge to translate the examples in Common Lisp to clojure. After reading the first few chapters I decided to give me a challenge to translate the examples in Common Lisp to clojure.

I will not copy the whole book, but I will give a general overview of the chapters and the process of iterative refinement of the implementations of the examples.

It will be possible for you to follow the examples even if you don't have a copy of PAIP but I highly recommend that you get one. This book is worth it's money.

The Book is divided in 5 Parts:

1. Introduction to Common Lisp:

In this part Norvig gives a short introduction to Common Lisp and highlights the advantages of common lisp. I will only translate the 2nd chapter: a simple lisp program to clojure.

2. Early AI programs

This part contains implementations of early AI programs like GPS-the general problem solver (wich is actually not so general...), ELIZA and STUDENT.

3. Tools and Techniques

This part contains topics like low-level efficiency Issues. This part will be interesting to port to the more functional clojure. It also covers Logic Programming,OOP and Knowledge Representation and Reasoning.

4. Advanced AI Programs

Norvig shows in this part examples of Advanced AI programs, like Expert Systems, Constraint Satisfaction, Natural Language Procesing and Unification Grammars. It ends with a Chapter about developing a Grammar for English.

5. The Rest of Lisp

In this part Scheme is covered. And a interpreter and a complete compiler for Scheme is implemented (with tail-call-recursion and call-cc). It contains also a very helpful chapter about Troubleshooting.

Tools

I plan to write the blog posts as Literate Programming files with org-mode + babel which has support for clojure. This has the advantage, that i can test my code on the go, extract the source-code from the document automagically and export the document to html which I post here. I am also planning to get an github account, so that i can make the files publicy available, so