Yes, use the more modern (ISO) get_char/1 and get_code/1. With:
get_yes_or_no(Result) :- get_code(Char), % read a character get_code(_), % consume the Return after it interpret(Char,Result), !. % cut -- see text
you should get:
?- get_yes_or_no(Result). |: Y
Result = yes ?
yes ?- get_yes_or_no(Result). |: N
Result = no ?
yes ?- get_yes_or_no(Result). |: l
Type Y or N:l
Type Y or N:l
Type Y or N:l
Type Y or N:Y
Result = yes ?
yes ?-
You can get a loop if you use get_char/1 instead of get_code/1 since interpret/2 (which expects an ascii code) will fail before the cut and execution will go to the second clause.
Hope this helps!