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!
			
			
									
									
						- 
				yiding
- Posts: 2
- Joined: 8 Jan 2014 2:59
- 
				George  
- Active Member
- Posts: 47
- Joined: 19 Sep 2011 8:54
Code: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: Select all
class facts
    myFact : (string, string) single.
 
clauses
    myFact("Test", "Cool").
 
%Fetch a value 
Test():-
   myFact(Test, Cool).
 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"
- 
				yiding
- Posts: 2
- Joined: 8 Jan 2014 2:59
Re:
It is helpful,thank you!George wrote:Code: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?
You need to have a class fact and define a fact with singleCode: Select all
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
For any personal support you can reach me at "georgeananth.prolog@gmail.com"

