gprolog专家系统 - 读取用户输入的问题

时间:2018-02-12 23:20:19

标签: prolog

我正在通过这个接受用户输入的prolog专家系统示例。我遇到了user_input读取方式的问题。我正在使用gprolog。

animal(dog) :-
  is_true('has fur'),
  is_true('says woof').
animal(cat) :-
  is_true('has fur'),
  is_true('says meow').
animal(duck) :-
  is_true('has feathers'),
  is_true('says quack').

is_true(Question) :-
  write('Does the animal have the following attribute: '),
  write(Question), write('? '),
  read_string(user_input,"\n","\r",End,Response), Response == "yes". /*this line*/

go:-
  animal(Animal),
  write('I guess that the animal is: '),
  write(Animal).
go:-
  write('I cannot recognize your animal').

我得到了:

uncaught exception: error(existence_error(procedure,read_string/5),is_true/1)

如果我尝试,那就是同样的错误:

read_string(user_input,"\n","\r",_,Response), Response == "yes".

0 个答案:

没有答案