Chapter 1
Logic Programming Basics

Prolog is at once fascinating and maddening because it’s so different from many of the other languages you might have experienced. Instead of giving Prolog a rote program describing exactly what to do, you’ll give it a database of facts such as “Bruce follows Joe.” Then you’ll add some basic inferences to your database such as “A user receives a tweet if that user follows someone, and that person tweets something.” Once you have that database, you can ask Prolog questions, called queries, such as “Who receives tweets from Joe?” Prolog will tie the facts and inferences together to solve some pretty demanding questions.

In this chapter, we’ll start with what makes Prolog different from other languages. Then, we’ll move into the Prolog environment and the basics of logic programming. Finally, we’ll look at making inferences with Prolog before we conclude.

As you work through this module, look for ways that Prolog can help you think about problem solving. Many programming languages can benefit from the way Prolog establishes rules and inferences. Some programming languages even have implementations built-in, especially Lisp dialects like Clojure. Keep your eyes open and you’re sure to find something that you find interesting. Let’s get started!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.21.86