Differences Between Prolog & Lisp
The computer languages Prolog and Lisp both rank high in the field of artificial intelligence (AI) research. Lisp is an older general-purpose language used to build programs that imitate human behavior while Prolog came later and focuses on knowledge bases and expert systems.
-
Why Lisp?
-
Lisp is one of the oldest high-level computer programming languages. As a general purpose language, it has a rich set of data types as well as built-in data structures like lists, trees and maps. It also provides a rich set of functions that operate on these data types and structures. In many ways the language is similar in scope to Java or Python, and over time has evolved to offer many of the same features including objects and dynamic data types.
Why Prolog?
-
Prolog is a declarative programming language that specializes in inference-based reasoning. It uses specialized logic to derive new knowledge from a list of rules known as a knowledge base. The language works well for tasks like proving mathematical theorems and building expert systems.
-
Different Approaches
-
The main difference between the two languages is the way problems are described. In Lisp, the programmer must describe how the computer will solve the problem. In a chess program, the developer would instruct the computer to analyze all possible moves, creating a decision tree in memory, then have the computer determine which of the choices is best. In Prolog, the developer does not need to describe how, but instead lists the rules then points the program toward the desired results. For example, the program may include a list of medical symptoms and possible diagnoses then, given a list of symptoms, the program would rank the most likely diagnoses.
Common Aim
-
One of the similarities that makes these languages unique is their ability to rewrite themselves as the program is running. This is how artificial intelligence occurs. In Lisp, the program itself can be treated as data that the program can manipulate. Genetic algorithms, programs that randomly mutate and evolve, can tune themselves over time, finding faster ways to reach a solution. In Prolog, new knowledge derived from existing rules as well as user input can be added to the knowledge base so it learns as it runs.
Choosing a Language
-
Both languages have their strengths and weaknesses. Prolog is suited well for its problem domain but cannot move far outside it. Lisp can solve more problems but it takes more code to do it. Choose Prolog for knowledge-based problems, Lisp for other areas.
For those who want to join the research field or just dabble in a new language, these are great to work with. Free open-source versions of both languages are available from the Internet and any average desktop computer has more than enough power to handle the workload.
-