views:

19

answers:

1

I am trying to add a rule dynamically to the knowledge base using SWI-prolog where the body of the rule is unknown beforehand.

The desired rule looks something like this:

rule(a) :- fact(1), fact(2).

Normally you would simply state

assert((rule(a):-fact(1),fact(2))).

but the problem is that the facts are decided at runtime(the number of facts is also unknown before the assertion).

That's why I would like to know whether there is a possibility to assert a rule where the body consists of a list of facts such as [fact(1),fact(2)]