From dietmar@sigma.upb.de Wed Mar  7 17:46:58 2001
Received: from sigma.uni-paderborn.de (sigma-gw.upb.de [131.234.242.18])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f27GkvZ18769
	for <prolog@swi.psy.uva.nl>; Wed, 7 Mar 2001 17:46:57 +0100 (MET)
Received: from armstrong (armstrong [131.234.130.106])
	by sigma.uni-paderborn.de (8.9.3/8.9.3) with SMTP id RAA21482
	for <prolog@swi.psy.uva.nl>; Wed, 7 Mar 2001 17:45:22 +0100 (MET)
Message-ID: <00bc01c0a725$70cc7550$6a82ea83@unipaderborn.de>
From: "Dietmar Harlos" <dietmar@sigma.upb.de>
To: <prolog@swi.psy.uva.nl>
Date: Wed, 7 Mar 2001 17:41:20 +0100
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Subject: [SWIPL] generating dynamic rules?

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







