Re: indeterministic ASSERT and RETRACT

---------

New Message Reply About this list Date view Thread view Subject view Author view

From: Timothy Menzies (tim@menzies.com)
Date: Fri 14 Apr 2000 - 14:57:54 MEST


why use the cut?

bassert(X) :- assert(X); retract(X), fail.

bretract(X) :- X,(retract(X);assert(X), fail).

----- Original Message -----
From: "Jan Wedekind" <unoh@rz.uni-karlsruhe.de>
To: <prolog@swi.psy.uva.nl>
Sent: Friday, April 14, 2000 6:24 AM
Subject: indeterministic ASSERT and RETRACT


>    I would like to write an application in prolog, that will extract
> knowledge from english sentences. I think, this program should add
> the learned predicates to the prolog-database by using "assert/1".
>    But the problem is, that "assert/1" has no indeterministic (I think you
> all know this). So I do not now, how to write an indeterministic rule,
which
> will clean up all created predicates on backtracking. Can anyone propose
> a solution for this?
>    The reason, why I am posting to the SWI-Prolog specific mailing-list
is,
> that perhaps there is a possibility to solve this problem by creating a
> new predicate "xassert" with the C-interface. However I do not now, how to
> create such a predicate: The problem is, that after a cut-and-fail
> (..., assertx( ... ), !, fail ) SWI-Prolog does not inform the C-routine
> "PL_assertx" about the failure.
>    If anyone has an answer to this problem, tell me! If there is a simple
> PROLOG-solution for this problem, forgive me!
>
> Jan Wedekind, student at University of Karlsruhe, Germany.
>
>
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
>
>     http://hcs.science.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://hcs.science.uva.nl/projects/SWI-Prolog/mailinglist/archive/
>


New Message Reply About this list Date view Thread view Subject view Author view


This archive was generated by hypermail 2b29

jan@swi.psy.uva.nl