mrm9084
mrm9084

Reputation: 493

Prolog basic questions

First, what do you recommend as a book for learning prolog. Second, is there an easy way to load many .pl files at once? Currently just doing one at a time with ['name.pl'] but it is annoying to do over and over again. I am also using this to learn.

Thanks

Upvotes: 7

Views: 628

Answers (6)

Robert Oschler
Robert Oschler

Reputation: 14385

I won't repeat the classic choices already mentioned in other answers, but I will add a note about Prolog Programming in Depth by Michael Covington, Donald Nute, and Andrew Vellino. Two chapters I would like to highlight are the chapters on hand tracing and defeasible rules. The former shows you how to trace out a Prolog computation on pencil and paper in an efficient and helpful manner. The latter shows you how to create Prolog code that supports defeasible rules. Unlike the rules you are accustomed to in Prolog that either succeed or fail outright and are not affected by anything not stated in the rule itself, defeasible rules can succeed on the information stated in the rule yet can be undercut by other rules in the knowledge base making the expression that are generally true but have exceptions easier in a manner that is compact and easy to understand. Said better by the book "A defeasible rule, on the other hand, is a rule that cannot be applied to some cases even though those cases satisify its conditions, because some knowledge elsewhere in the knowledge base blocks it from applying."

It's an intriguing concept that I have not found in other books.

Upvotes: 2

m09
m09

Reputation: 7493

You can check out this question. There are several nice books recommended back there.

Upvotes: 4

mat
mat

Reputation: 40768

In SWI-Prolog, also check out:

?- make.

to automatically reload files that were modified since they were consulted.

Upvotes: 4

CapelliC
CapelliC

Reputation: 60034

If you are incline to a mathematical introduction, Logic, Programming and Prolog (2ED) is an interesting book, by Nilsson and Maluszinski.

Programming in Prolog, by Clocksin and Mellish, is the classic introductory textbook.

Upvotes: 4

BillRobertson42
BillRobertson42

Reputation: 12883

This is a nice short little intro: http://www.soe.ucsc.edu/classes/cmps112/Spring03/languages/prolog/PrologIntro.pdf

I also want to say there's a nice swi oriented pdf out there, but I can't find it.

Upvotes: 2

Daniel Lyons
Daniel Lyons

Reputation: 22803

First, welcome to Prolog! I think you'll find it rewarding and enjoyable.

The books I routinely see recommended are The Art of Prolog, Programming Prolog and Clause and Effect. I have Art and Programming and they're both fine books; Art is certainly more encyclopedic and Programming is more linear. I consult Art and Craft a lot lately, and some weirder ones (Logic Grammars for example). I'm hoping to buy Prolog Programming in Depth next. I don't think there are a lot of bad Prolog books out there one should try to avoid. I would probably save Craft and Practice for later though.

You can load multiple files at once by listing them:

:- [file1, file2, file3].

ALso, since 'name.pl' ends in '.pl' you can omit the quotes; single quotes are really only necessary if Prolog wouldn't take the enclosed to be an atom ordinarily.

Hope this helps and good luck on your journey. :)

Upvotes: 5

Related Questions