Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prolog basic questions

Tags:

prolog

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

like image 239
mrm9084 Avatar asked Mar 01 '12 03:03

mrm9084


3 Answers

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. :)

like image 90
Daniel Lyons Avatar answered Sep 28 '22 02:09

Daniel Lyons


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.

like image 30
CapelliC Avatar answered Sep 28 '22 02:09

CapelliC


In SWI-Prolog, also check out:

?- make.

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

like image 22
mat Avatar answered Sep 28 '22 01:09

mat