Eliza in Erlang

Introduction

This is Chapter 5 of the book PAIP. It implemented an early-day algorithm to dialog with a machine. It had the appearance of AI, but actually it was just another interpreter: programmer designs some rules at first, and then eval the user’s input. The main topic is pattern-match programming.

Pattern-match is really my favorite language feature. Erlang and many functional programming languages (Oz, ML, …) support it quite well. C language offers switch statement which can only match constant expression in each clause. Different languages may have different scopes for pattern variables.

Continue reading →

GPS in Erlang

The book PAIP

GPS is the acronym for General Problem Solver. The book Norvig, Peter. Paradigms of artificial intelligence programming: case studies in Common LISP. Morgan Kaufmann, 1992 spent the whole Chapter 4 to show how you can program a GPS using common lisp and pointed out several “bugs” that you should pay attention to. This is a great book that I highly recommend it.

Since EOPL, I am convinced that Erlang is a very good language to implement other language or write AI paradigm program. My several projects are:

More details on Common Lisp implementation can be found in the open-source repo: https://github.com/norvig/paip-lisp.

Continue reading →