Dear support staff, I recently acquired a book Introduction to Prolog by Ramahandran Bharath(1986, TAB Books) I have loaded ciao-1.10p5Win32 on my window 95 system and have been reading the manual. I am going through the examples in the first chapter on using the 'assertz' statement to build a data base. If I exit out of ciao top level shell and then restart it I lose the definitions I have just entered. Is there a way to save this work in a file and load it with the Module/1 or the default file that is loaded each time the top level shell is started.
Thanks...Chuck Skelly(registered as 'skellyc(a)us.ibm.com)
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
One way is to redirect output using tell(filename), then type listing, close the file using told, and redirect the output again using tell(user). You might not get exactly what you want, but you should be able to fix it with the editor.
On 03/02/2006, at 8:44 PM, CFS383150(a)aol.com wrote:
Dear support staff, I recently acquired a book Introduction to Prolog by Ramahandran Bharath(1986, TAB Books) I have loaded ciao-1.10p5Win32 on my window 95 system and have been reading the manual. I am going through the examples in the first chapter on using the 'assertz' statement to build a data base. If I exit out of ciao top level shell and then restart it I lose the definitions I have just entered. Is there a way to save this work in a file and load it with the Module/1 or the default file that is loaded each time the top level shell is started. Thanks...Chuck Skelly(registered as 'skellyc(a)us.ibm.com)
Barry Dwyer
============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------