Notice that the line starts with a :- and ends with a period. This is accomplished with the following line: The first thing to do is to load your KB. Because the plan is to compile this into an executable, I'll call this. Grand_father(X,Z) :- father(X,Y), parent(Y,Z). % This is the Prolog version of the family example It's just a basic KB that we can start with. This KB comes directly from page 42 of "Thinking as Computation" by Hector Levesque. Let's get started with a quick knowledge base. Because of that, I created a quick little program that will demonstrate a simple menu and some I/O. When I started learning Prolog, I thought that the interactive console was great for trying things out and running queries real time, but I noticed an overall lack of instruction out there on writing a menu driven program that will take input. Example Prolog Program An Example Prolog Program Introduction
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |