Discussions related to Visual Prolog
Harrison Pratt
VIP Member
Posts: 452
Joined: 5 Nov 2000 0:01

Is there a VP syntax to refer to a FACT this way?

Unread post by Harrison Pratt »

It is straightforward to refer to other predicates in predicate and fact declarations.

Is there a way to similarly directly refer to a database fact?

Code: Select all

class facts - menuDB     menuAction : (string ActionName, predicate Action).     namedProperty : (string PropertyName, fact Property). % <== can VP do something like this ?   clauses     menuAction("Open database", dbOpen).     menuAction("Export database", dbExport).
User avatar
Thomas Linder Puls
VIP Member
Posts: 1419
Joined: 28 Feb 2000 0:01

Re: Is there a VP syntax to refer to a FACT this way?

Unread post by Thomas Linder Puls »

The short answer is no. facts are very different from each other (different number of arguments of different types).

But if we are for example considering fact variables of type string, then you can assert getter and the setter predicates.

Code: Select all

class facts     namedProperty : (string Name, function{string} Get, predicate{string} Set).   clauses     namedProperty("aaa", {  = aaa }, { (S) :- aaa := S }).     namedProperty("bbb", {  = bbb }, { (S) :- bbb := S }).
But there is no simple syntax for this.

(You will most likely not need a fact for this, because it is not likely that you are going to invent additional facts, getters and setters while during program run).
Regards Thomas Linder Puls
PDC
Harrison Pratt
VIP Member
Posts: 452
Joined: 5 Nov 2000 0:01

Re: Is there a VP syntax to refer to a FACT this way?

Unread post by Harrison Pratt »

Very clear answer -- thank you! :D
Post Reply