

















   Purpose: ask questions that have a one-character answer.

%   Conversion not
nd of line is 10 in C-Prolog, 31 in Dec-10 Prolog.

%   Note: the public pr
ates with two underscores in their names are
%   public just so that ca
 can see them.  They are not meant to be
%   called by your program
The other public predicates are meant to
%   be so called.

:- 
ic
	ask/2,		ask__1/2,
	ask/3,		ask__2/3,
	ask_default_chara


















































































































































































































































































































































































































































































































































































126 (that is, it won't be a s
 or a control character).
sk(Question, Answer) 
talk_to_user_whil
k__1(Question
swer)).


__1(Q
i






































, !,
	sk






































































































































































, !,
	skip(31),
	Answer = Char.
ask__2(31, _, Default, Answer) :- !,
	Answer = Default.
ask__2(_, Question, Default, Answer

	skip(31),
	ask__2(Question, Default, Answer).


%   yesno(Question)
%   asks the question, and succeeds if the answer
y or Y, fails if
%   the answer is n or N, and repeats the question if it is anything else.

yesno(Questio




































%   force lower case
	(   Ch
 31		%   end of line
	; 
ip(31)		%   skip if 
sn't
	),  !,
	ye
_1(Answer, Q
ion).

y
__1(
*y*/, _) :- !.
yesno__1(110/*n*/, _) :- !, fail.
yesno__1(_, Question) :-
	write('Please answer Yes or No.'), nl,
	ye
_1(Question).



%   yesno(Question, Default)
%   is like yesno(Question), except that if the user type
























































































 Answer = Default		% end of
e
	;   skip(31), Answer
Char\/32	% skip to 
	),  !,
	yesno_
nswer, Ques
, Defau


y


*y*/, _, _) :- 



*n*/, _, _) :- !, fail.
yesno__2(_, Question, Default) :-
	write('Please answer Yes or No.'), nl,
	yesno__






