Code Monkey home page Code Monkey logo

the-power-of-prolog's Introduction

The Power of Prolog

Introduction to modern Prolog

Prolog is a programming language that is rooted in formal logic. It supports backtracking and unification as built-in features. Prolog allows us to elegantly solve many tasks with short and general programs.

The goal of this material is to bridge the gap between the great traditional Prolog textbooks of the past and the language as it currently is, several decades after these books were written. You will see that many limitations of the past are no longer relevant, while several new constructs are now of great importance even though they are not yet covered in any available Prolog book.

Reading this book

This book is self-hosting: It includes an HTTP server that lets you browse most of the content locally. When you access files that are not locally available, it redirects to their online versions.

To run it, you need SWI-Prolog≥7.5.10. To spawn the server on port 5053, use for example:

$ swipl main.pl --port=5053

Then, direct your browser to:

http://localhost:5053/prolog

If you are new to Prolog, read the chapters in order for a self-contained exposition of many important language features. If you already have some experience with Prolog and would like to learn more about more recent aspects, I recommend you start with the chapter on integer arithmetic and proceed with the chapters it links to.

About this book

The latest version of this book is always available from:

https://www.metalevel.at/prolog

I will periodically synch this repository with new material as it becomes available.

I started writing this book in 2005, when I was a student of Ulrich Neumerkel in Vienna. A collection of Prolog meta-interpreters formed the first chapter.

You can run most of the examples with any popular Prolog system, such as GNU Prolog, SICStus Prolog, YAP and SWI. In some cases, slight modifications may be necessary to adjust for different libraries or small variations. See your Prolog system's manual, or ask on Stackoverflow and comp.lang.prolog for more information.

On teaching Prolog

Prolog is an interesting programming language: It has a pure monotonic core, and it also has features that are called impure. You, the programmer, must decide in which subset of the language you want to program.

In a sense, programming in Prolog is like writing a poem: You can achieve great effects by writing under stringent constraints. In Prolog, you often get the best results by restricting your work to the pure core of the language. As long as you do this, you can benefit from strong logical properties which let you reason about your programs in systematic ways that are not available in most other programming languages.

In the past decades, many pure features have become widely available in Prolog systems. This book explains many of these new features, and shows you how you can use them to achieve general and efficient Prolog programs.

Le message dur:
Restez purs!

the-power-of-prolog's People

Contributors

triska avatar jcumin avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.