I need to be able to access the body of a rule in a different rule. For example, in the following, I want to be able to use the facts of rule
in myRule
when I call myRule(rule)
.
rule :-
fact1(...),
fact2(...),
fact3(...).
myRule(RuleName) :-
RuleName :- (F1, F2, F3),
write(F1).
Obviously the above code does not work, and I have no idea of how to go about this, so I am asking for tips or anything to get me going in the right direction.
Please note that I am very new to Prolog and to logic programming in general. I'm having a hard time finding answers since I am not sure what exactly to look for.
Aucun commentaire:
Enregistrer un commentaire