From bill@billnet.org Wed Mar  7 19:13:09 2001
Received: from harrier.prod.itd.earthlink.net (harrier.prod.itd.earthlink.net [207.217.121.12])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f27ID8Z22072
	for <prolog@swi.psy.uva.nl>; Wed, 7 Mar 2001 19:13:08 +0100 (MET)
Received: from computer.billnet.org (pool-63.52.29.210.atln.grid.net [63.52.29.210])
	by harrier.prod.itd.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id KAA29083;
	Wed, 7 Mar 2001 10:12:39 -0800 (PST)
Message-Id: <5.0.2.1.0.20010307131608.00a008b0@mail.earthlink.net>
X-Sender: billhworth@mail.earthlink.net
X-Mailer: QUALCOMM Windows Eudora Version 5.0.2
Date: Wed, 07 Mar 2001 13:17:14 -0500
To: "Dietmar Harlos" <dietmar@sigma.upb.de>, <prolog@swi.psy.uva.nl>
From: Bill Hollingsworth <bill@billnet.org>
Subject: Re: [SWIPL] generating dynamic rules?
In-Reply-To: <00bc01c0a725$70cc7550$6a82ea83@unipaderborn.de>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed

Hi,

Try this:

asserta(test:-(rule1,rule2)).

Bill Hollingsworth
http://www.billnet.org

At 05:41 PM 3/7/2001 +0100, Dietmar Harlos wrote:
>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
>
>
>
>
>
>
>
>
>----------------
>* To UNSUBSCRIBE, please use the HTML form at
>
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
>
>or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe"
>(without the quotes) and *no* message body.
>
>** An ARCHIVE of this list is maintained at
>
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/

