Happy New Year to All.
%=== 1 ===%
While trying unknown_predicate_handler/3 and unknown/2 to use in a
dynamic clause loader which reads clauses from an indexed file, asserts
and retries the failed goal, I found that unknown_predicate_handler/3
fails with a clause that has a body:
%unknown_predicate_handler(X,_,X) :- asserta((q(456))). % works
%unknown_predicate_handler(X,_,X) :- asserta((q(456) :- true)). % works
unknown_predicate_handler(X,_,X) :- asserta((q(456) :-
write(123))). % asserts but fails
%retry(X) :- asserta((q(456) :- write(123))), X. % works
%:- unknown(_,retry(_)).
:- q(X),write(X),nl.
:- listing(q/1).
:- q(X),write(X),nl.
:- listing(q/1).
%=== 2 ===%
Example code in Chapter 21: C Language interface to YAP (pdf page 199)
has errors:
YAP_dogoalinfo goalInfo;
// manual error YAP_ArraysOfTerm -> YAP_ArgsOfTerm
YAP_Term *goalArgs = YAP_ArgsOfTerm(g);
// manual error YAP_Functor * -> YAP_Functor
YAP_Functor goalFunctor = YAP_FunctorOfTerm(g);
// manual error YAP_FunctorToGoal -> YAP_FunctorToPred
YAP_PredEntryPtr goalPred = YAP_FunctorToPred(goalFunctor);
int result = YAP_EnterGoal( goalPred, goalArgs, &goalInfo );
while (result)
result = YAP_RetryGoal( &goalInfo );
YAP_LeaveGoal(TRUE, &goalInfo);
%=== 3 ===%
When using YAP_RunGoal or YAP_RunGoalOnce in Yap->C->Yap:
:- c_function(X), % which calls yap predicate via RunGoal/Once
write(X),nl.
worked ok but
a :- c_function(X),
write(X),nl.
:- a.
would do 2 writes with one having a mystery value.
If this is not a known problem, I will supply full example if needed.
%=========%
Regards,
Tony.
------------------------------------------------------------------------------
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users