Suppose I have facts that can be /1 and /2 versions, I can relate one with the other with a rule:
t(T,[T]) :- t(T).
and hope that t(1,[1])
can be found whenever t(1)
is asserted.
t(1).
?- t(1,X). % true, X = [1]
However, this relied upon t(1)
being found in the database.
Is this possible to use rules only for matching on the contents of the fact the database? Suppose I have terms that are constructed during the frame only, can the rulebase be used (for example, to allow t(X,[X])
to be used whenever t(X)
is found)?
?- t(1,[X])=t(1).
In practice, Iām trying to get the following to succeed:
?- maplist([t(_,R),R]>>(true),
[t(1,[1]), t(2)], % Input list must be normalized for the maplist predicate
Result).
false.
ā¦ fails because t(2)
is not in the database when t(_,R)
is unified with the rule body of t(T,[T])
.