Subject: [SWIPL] Search mechanism.

From: "Nick Fedorov" <[email-masked]>
Date: Mon, 1 Oct 2001 04:44:49 +0400

Hi.
I try to do this (search task):
--------------
startup    :-    assert(goal(a)), asserta(statement(b)),
                    asserta(statement(c)).

question(R) :-    startup, r(R).    % R is undefined variable

r(R) :-
    goal(X),
    statement(Y),
    ...                              % do some manipulations with X and Y
    asserta(goal(new_val)),
    success(R).                    % success or not?
--------------
?- question(X).
--------------
There are several statement/1 facts and if success/1 fails, then prolog
 makes Redo on <statement(Y)>. I want prolog make Redo on <goal(X)> too,
 but it doesn't (<asserta(goal(new_val))> doesn't update view of database).
Prolog makes Redo on <goal(X)> if several goal/1 facts were asserted
 at startup.

What means
^ Call: ...
^*Call: ...

I tried make recursive r/1:
    ...
    (success(R) ; r(R)).
than it works as I need (prolog see all asserted goals/1), but I got another
 problem I mailed earlier.

Am I right?
How can I force prolog make Redo on goal/1 too? May I update
 database view manualy?

Thank you.