, :
ConditionPart ---- > ActionPart
ConditionPart - , a ActionPart - . :
[ Condi, Ccnd2, Cond3,... ]
Condi, Cond2 .. - Prolog. , . , :
[ Actionl, Action2,... ]
Prolog. . , . , , . "stop" .
23.8 , , , .
-. |
23.S. ,
[ .)
:- (800, xfx,-
:- op(300, fx, num)
II Prolog
t num X, rum Y, X > Y 1 >
[ is X - Y, replace! num X, num NewX) ].
[ num X] ------- > [ write (X), Stop ].
%
num 2 5. num 10. num 15. num 30.
, , Prolog. ;
asserts! object) retract! Object}
:
replace! Objectl, Object2):-retract! Qbjectl),!, assertz(Object2).
, retract ( ) .
, , , 23.9. , . , , , ( ). . Prolog, , . :?- run.
|
|
23.9. ,
% , . % % assert/retract
:- op(800, xfx, >).
% ran: , Condition > Action,
% , 'stop'
run: -
Condition ------- > Action, %
testl Condition), i ?
execute! Action).
% test ([ Condition!, condition2,...]) %
test( []). %
23.
test([First I Rest]):- *
call(First), test(Rest).
% execute! [ Actionl, Action2,..,]):
execute! [ stop]):-!. %
execute! >: - * ( )
run. %
execute; [First t Rest]):-call{ First), execute (Rest).
replace A, B):- %
retract! ),!, %
assert().