Compare the Difference Between Similar Terms

Difference Between Prolog and Lisp

Prolog vs Lisp

Prolog and Lisp are two of the most popular AI (Artificial Intelligence) computer programming languages today. They are built with two different programming paradigms. Prolog is a declarative language, while Lisp is a functional language. Both are used for various AI problems but Prolog is used most for logic and reasoning problems, while Lisp is used for problems with rapid prototyping needs.

Prolog

Prolog is an AI programming language. It belongs to the family of logic programming languages. Prolog is a declarative language, in which computations are carried over by running queries over the relations (which represent program logic), which are defined as rules and fact. Developed in 1970, prolog is one of the oldest logic programming languages and one of the most popular AI programming languages today (along with Lisp). It is a free language, but many commercial variants are available. It was first used for natural language processing, but now it is been used for various tasks such as expert systems, automated answering systems, games and advanced control systems. Prolog has only one data type called the term. A Term can be an atom, number, variable or a compound term. Numbers can be float or integers. Prolog supports lists and string as collection of items. Prolog defines relations using clauses. Clauses can be either rules or facts. Prolog allows iteration thorough its recursive predicates.

Lisp

Lisp is a family of computer programming languages. And the most famous Lisp dialects used for general purpose programming today are Common Lisp and Scheme. The name LISP comes from “LISt Processing” and as it hints, Lisp’s major data structure is the linked list. In fact the whole source is written using lists (using prefix notation), or more correctly parenthesized lists (called s-expressions). For example, a function call is written as (f a1 a2 a3), which means function f is called using a1, a2 and a3 as input arguments for the function. Therefore it is called an expression oriented language, where all data and code are written as expressions (there is no distinction between expressions and statements in Lisp). This nice feature is very special to Lisp, where it could be used to extend the language to the problem at hand by writing helpful macros. Although tail-recursion is used by programmers to express loops, all frequently seen Lisp dialects do include control structures like loop. Furthermore, Common Lisp and scheme have mapcar and map that are examples of functions, which provide looping functionality by applying the function successively to all its elements and then collects the results in to a list.

What is the difference between Prolog and Lisp?

Although, Prolog and Lisp are two of the most popular AI programming languages, they have various differences. Lisp is a functional language, while Prolog is a logic programming and declarative languages. Lisp is very flexible due to its fast prototyping and macro features, so it actually allows extending the language to suit the problem at hand. In the areas of AI, graphics and user interfaces, Lisp has been used extensively because of this rapid prototyping ability. However, due to its inbuilt logic programming abilities, Prolog is ideal for AI problems with symbolic reasoning, database and language parsing applications. Choice of one over the other completely depends on the type of AI problem that need to be solved.