present! Answer)
16.5, . Answer , , , . present . , , "how", , . 16.2.1 16.2.4.
16.5. : ,
% , %
present; Answer):-
nl, show-conclusion (Answer),
nl, write('Would you like to see how? '),
getreply(Reply),
(Reply = yes,!,
show(Answer) %
true). showconclusion (Answerl and Answer2):-!, showconclusion; Answerl), write ('and '), showconclusion (Answer2).
376 II. Prolog
showconclusion(Conclusion was Found):-write(Conclusion).
% show
!. |
show(Solution):-
show(Solution, 0),
show(Answerl and Answer2, H):-!, show(Answerl, H), tab(H), write(and), nl, show(Answer2, H).
show(Answer was Found, H):-tab(H), writeans(Answer), nl, tab(H), write ('was '), showl(Found, H).
showl(Derived from Answer, H):-!, write(Derived), write ('from'),
nl, HI is H + 4, show(Answer, HI).
% , 0 % ,
%
%
%
%
%
showl(Found, _):- % Found 'told' % ( ) 'found as fact' ( ) write(Found), nl.
writeans(Goal is true):-!, write(Goal).
writeans(Answer):-write(Answer).
%
%
%
'is true' ( ) -
16.3.5.
Prolog , expert ( 16.6). expert (. 16.3-16.5), , :?- expert.
Question, please: % X isa animal and goliath isa X. % Is it true: goliath has hair?