Subject: [SWIPL] generating dynamic rules?

From: "Dietmar Harlos" <[email-masked]>
Date: Wed, 7 Mar 2001 17:41:20 +0100

Hello,

I have the following problem with SWI-Prolog. I have to generate a dynamic
rule at runtime, but the variables don't match. Please see this short
example:

--- cut here --

knot(1, fetch(Variable)).
knot(2, write(Variable)).

dynrule:-knot(1,Rule1), knot(2,Rule2), assert((testme:-Rule1,Rule2)),
listing(testme), testme.

fetch(A) :- A=4.

--- cut there --

The output at the prolog prompt is as follows:

?- dynrule.

testme :-
        fetch(A),
        write(B).
_L114

Yes
?-

Can anyone help me? Have I to process the two parts of the rule as strings?
Is there any "string to rule" build-in predicate? You can answer me also in
German.

many greetings
Dietmar