Answers storing

Description

Program remember answer

Source: Building Expert Systems in PROLOG Publisher

Download

Program source code: answers_storing.pl

Listing

ask(A, V):-
known(yes, A, V), % succeed if true
!. % stop looking
 
ask(A, V):-
known(_, A, V), % fail if false
!, fail.
 
ask(A, V):-
write(A:V), % ask user
write('? : '),
read(Y), % get the answer
asserta(known(Y, A, V)), % remember it
Y == yes. % succeed or fail

Comments

pl/prolog/pllib/answers_storing.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0