Prolog/What is Prolog

What is Prolog?Edit

Prolog is a declarative programming language. This means that in prolog, you do not write out what the computer should do line by line, as in procedural languages such as C and Java . The general idea behind declarative languages is that you describe a situation. Based on this code, the interpreter or compiler will tell you a solution. In the case of prolog, it will tell you whether a prolog sentence is true or not and, if it contains variables, what the values of the variables need to be.

This may sound like a godsend for programmers, but the truth is that prolog is seldom used purely in this way. Though the declarative idea is the backbone of prolog, it is possible to see prolog code as procedural. A prolog programmer will generally do both depending on the part of the code he or she is reading or writing. When learning prolog however, experience in procedural programming is in no way useful. (it is often said that it is easier to learn prolog for someone who does not have any experience in procedural programming than for someone who does)

Prolog is considered a difficult language to master, especially when the student tries to rush things, mainly because of the different way of thinking the student has to adopt and amount of recursion in prolog programs. When used correctly, however, prolog can be a very powerful language.

Why Learn Prolog?Edit

Learning prolog will certainly not always be as fruitful as learning C++, Java or Python. Prolog is most useful in the areas related to Artificial Intelligence research, such as problem solving, (path) planning or natural language interpretation. Some fields that are not strictly AI, such as parser building, can also benefit greatly from prolog.

However those that do not work with natural language systems daily can also benefit greatly from prolog. As prolog uses certain programming techniques that are considered difficult or advanced (most notably recursion), prolog can be a great way of improving insight into these techniques. A practised prolog programmer will certainly have an in-depth understanding of such concepts as recursion, searching problem trees and constraint logic programming. Prolog can even serve as a 'sketching' tool to try out basic programming ideas before implementing them in procedural languages.

Because of its close ties with predicate logic, learning prolog can lead to a more fluent understanding of predicate logic. (Vice versa, anyone experienced in predicate logic will certainly be able to pick up prolog faster)

All in all, if you're looking to improve your resume as a webdesigner, prolog may not be the way to go. Prolog is still mainly an academic language. This doesn't mean it's purely for testing ideas or outlining techniques. Very complex programs have been written in prolog. Most of all prolog is a complex, powerful, and elegant language that can inspire great satisfaction in its users; At times inspiring immense irritation as well.

The learning process of prolog requires some attention. As stated before, learning prolog is not easy. Prolog doesn't work as naturally as procedural languages and therefore requires a specific way of thinking. When learning prolog it's important to take things slow and let the concepts settle before moving on. It's also advisable to use more than one text or textbook in the learning process to get multiple perspectives on a subject. As a final note, once you've mastered something tricky that wasn't explained clearly here, feel free to edit this text, so that future students can learn it more easily. It is a wiki after all.


Next: Introduction to logic

Last modified on 6 October 2007, at 02:20