Re: interactive use, the overwhelming norm ?
Kilian Evang <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Hi Patrick, On 2014-02-16 06:11, Patrick wrote: > Is there a simple example that takes a database file, a query file and > writes the results to a 3rd file? one way is to define a "main" predicate (doesn't have to be called "main") and call it from the command line, like this: dbfile.pl --------- a(2). a(3). queryfile.pl ------------ main :- forall(a(X), (write(X), nl)), close(Stream), halt. From the command line, call: swipl -g main dbfile.pl queryfile.pl > resultsfile.txt resultsfile.txt --------------- 2 3 You can also create an executable, see: http://www.swi-prolog.org/FAQ/PrologScript.txt http://www.swi-prolog.org/pldoc/man?section=compilation#sec:2.10.2.4 Hope this helps, Kilian