私はプロローグを学び始めたばかりです。私は CS 2300 クラスのためにそれを学んでいます。私は今、基礎を学ぼうとしています。述語を .pl ファイルに追加するにはどうすればよいですか? .pl ファイルに述語を追加しようとしています。私はこれをやっています:
married(X,Y) :- married(Y,X).
そして、私はエラーを受け取ります:
ERROR: Undefined procedure: (:-)/2
ERROR: Rules must be loaded from a file
ERROR: See FAQ at http://www.swi-prolog.org/FAQ/ToplevelMode.tx
どういうわけかこれを有効にすることになっていますか?
これは与えられた.pl
ファイルです:
% File FAMILY.PL
% Part of a family tree expressed in Prolog
% In father/2, mother/2, and parent/2,
% first arg. is parent and second arg. is child.
father(michael,cathy).
father(michael,sharon).
father(charles_gordon,michael).
father(charles_gordon,julie).
father(charles,charles_gordon).
father(jim,melody).
father(jim,crystal).
father(elmo,jim).
father(greg,stephanie).
father(greg,danielle).
mother(melody,cathy).
mother(melody,sharon).
mother(hazel,michael).
mother(hazel,julie).
mother(eleanor,melody).
mother(eleanor,crystal).
mother(crystal,stephanie).
mother(crystal,danielle).
parent(X,Y) :- father(X,Y).
parent(X,Y) :- mother(X,Y).