Discussions related to Visual Prolog
yiding
Posts: 2
Joined: 8 Jan 2014 2:59

How to initialize single fact in a class that do not create object?

Unread post by yiding »

Hi, there.
It is said that a single fact should be initialized in constructor. But if I have a class that do not create object, then it have no constructor,how to initialize my single fact?

By the way, what is the meaning of " <> " and " >< "? I can't find this two operators definition in anywhere.

Thanks!
User avatar
George
Active Member
Posts: 47
Joined: 19 Sep 2011 8:54

Unread post by George »

It is said that a single fact should be initialized in constructor. But if I have a class that do not create object, then it have no constructor,how to initialize my single fact?
Code:

Code: Select all

class facts     myFact : (string, string) single.   clauses     myFact("Test", "Cool").   %Fetch a value Test():-    myFact(Test, Cool).  
You need to have a class fact and define a fact with single

and you have to have one definition for that - that will be a default value - and you can't retract the single fact..

whenever you assert something that will get override

Ref the following URL for more detail

http://wiki.visual-prolog.com/index.php ... ence/Facts


Sympol: <> is used for not equality check

Ex : If you want to check two variable are not equal you can use "<>"

Code: Select all

%Fetch a value Test():-    myFact(Test, Cool),    Test <> Cool.

For any personal support you can reach me at "georgeananth.prolog@gmail.com"
Kind Regards,
George Ananth. S | Prolog Developer
georgeananth.prolog@gmail.com
+91 9791499282
yiding
Posts: 2
Joined: 8 Jan 2014 2:59

Re:

Unread post by yiding »

George wrote:
It is said that a single fact should be initialized in constructor. But if I have a class that do not create object, then it have no constructor,how to initialize my single fact?
Code:

Code: Select all

class facts     myFact : (string, string) single.   clauses     myFact("Test", "Cool").   %Fetch a value Test():-    myFact(Test, Cool).  
You need to have a class fact and define a fact with single

and you have to have one definition for that - that will be a default value - and you can't retract the single fact..

whenever you assert something that will get override

Ref the following URL for more detail

http://wiki.visual-prolog.com/index.php ... ence/Facts


Sympol: <> is used for not equality check

Ex : If you want to check two variable are not equal you can use "<>"

Code: Select all

%Fetch a value Test():-    myFact(Test, Cool),    Test <> Cool.

For any personal support you can reach me at "georgeananth.prolog@gmail.com"
It is helpful,thank you!
Post Reply