swi-prolog

Dynamic rule assertion in SWI-prolog

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 num...