We are not familiar with this book, but if you are learning the language the best way to create a database is to type it into a file (best if it is a module) and then load it into the top level. For example, edit file foo.pl to contain:
------------------------------ :- module(_,_).
p(a,b). p(c,d). ------------------------------
and then load it into the top level using:
?- use_module(foo).
Some additional comments:
- You can drop the ":- module(_,_)." declaration at the beginning of the file, but we strongly recommend it because it allows the compiler to catch many more errors (and it is very little additional work).
- We recommend using emacs and the Ciao emacs interface (which gives you many things including graphical menus and a source level debugger) for all of the above. You can also use another editor of course, but the functionality is reduced. We also have an eclipse plugin in beta.
- If what you really want is to make changes to the database dynamically (calls to assertz) and have them survive from one execution to the next one this is in fact supported by the Ciao notion of 'persistent predicates'. Read the corresponding chapter in the manual or
Cheers --Manuel