Thursday , May 6 2021

Prolog Problems – Prolog Site, Hacker News

This is a remake of theP – (*******************************: Ninety-Nine Prolog Problemscollection that I assembled over several years of teaching at the University of Applied Sciences (Berner Fachhochschuleat Biel-Bienne, Switzerland. The collection is structured into seven sections. I have renumbered the problems in order to get more freedom to rearrange things within the sections.

The purpose of this problem collection is to give you the opportunity to practice your skills in logic programming. Your goal should be to find the most elegant solution of the given problems. Efficiency is important, but logical clarity is even more crucial. Some of the (easy) problems can be trivially solved using built-in predicates. However, in these cases, you learn more if you try to find your own solution.

Every predicate that you write should begin with a comment that describes the predicate in adeclarativestatement. Donotdescribe procedurally,whatthe predicate does, but write down alogical statementwhich includes the arguments of the predicate. You should also indicate the intended data types of the arguments and the allowed flow patterns.

The problems have different levels of difficulty. Those marked with a single asterisk

are easy. If you have successfully solved the preceeding problems you should be able to solve them within a few (say 54) minutes . Problems marked with two asterisks

are of intermediate difficulty. If you are a skilled Prolog programmer it shouldn’t take you more than – minutes to solve them. Problems marked with three asterisks

are more difficult. You may need more time (ie a few hours or more) to find a good solution.

You can findsolutions.of the problems at the end of each section. All programs have been tested on theSWI-Prologsystem. SWI-Prolog offers a comprehensiveFree SoftwareProlog environment, licensed under the Lesser GNU Public License. SWI-Prolog is widely used in research and education as well as for commercial applications.

If you find errors or better solutions, please send mail to: werner.hett (at)

First section:Prolog Lists

********************************************** Read More


About admin

Check Also

Haskell Problems for a New Decade, Hacker News

Haskell Problems For a New Decade It has been a decade since I started writing Haskell, and I look back on all the projects that I cut my teeth on back in the early part of this decade and realise how far the language and tooling have come. Back then Haskell was really barely usable…

Leave a Reply

Your email address will not be published. Required fields are marked *