Hello Edmund,
Adrian is right - clause/2 is not supposed to work with it's first
argument uninstantiated. Bratko agrees, and I'm sure C&M would also
but haven't got one to hand.
The simplest way to do what you want in Poplog Prolog (and various other
Prologs) is to use current_predicate/2, as in:
married(charles, diana).
separated(charles, diana).
relations(R, charles, diana) :-
current_predicate(R, X),
clause(X, true),
X =.. [R, charles, diana].
?- relations(R,C,D).
R = separated
C = charles
D = diana ? ;
R = married
C = charles
D = diana ? ;
no
Just out of interest, which Prologs allow clause/2 with an
uninstantiated first argument? This is rather naughty since most
textbooks will say it's illegal.
tom
|