Home | Notes | Languages | Programs | Homework |
Re: How do u enter facts and rules in prolog compiler? |
Stephen Edwards (edwards@CS.VT.EDU)
Wed, 21 Feb 2001 08:42:50 -0500
Message-ID: <3A93C5DA.5002F949@cs.vt.edu> Date: Wed, 21 Feb 2001 08:42:50 -0500 From: Stephen Edwards <edwards@CS.VT.EDU> Subject: Re: How do u enter facts and rules in prolog compiler?
> Pak Chung wrote:
>
> when run the program it always starts with a "?:-"
> how do u enter facts and such?
Type your rules and facts in a separate text file (your "source file").
When you are in the interpreter, you "consult" this file, which is the
prolog term for loading it. The syntax is very simple:
?- ['myfile.pl'].
Note the use of single quotes. This will read in the rules and facts
defined in that file. Unlike Scheme, in Prolog, one normally only gives
queries at the interpreter's command prompt (not fact or rule definitions).
-- Steve
-- Stephen Edwards 604 McBryde Hall Dept. of Computer Science e-mail : edwards@cs.vt.edu U.S. mail: Virginia Tech (VPI&SU) office phone: (540)-231-5723 Blacksburg, VA 24061-0106 -------------------------------------------------------------------------------
Home | Notes | Languages | Programs | Homework |