swi-prolog 5.10.2
我已经输入了这个 prolog 程序。但是,当我运行选项 a 时,我收到以下错误。
go/0 Undefined Procedure save/1
我确信 save 是一个正确的关键字谓词,并且文件的路径也确实存在。不知道我哪里出错了。
What does the /0 /1 mean in go and save?
源代码
/* Shopping list */
go:-reconsult('~/projects/prolog/chap7/shopping.pl'),
write('a: See list'), nl,
write('b: Add to list'), nl,
write('c: Delete from list'), nl,
read(Choice),
choice(Choice),
save('~/projects/prolog/chap7/shopping.pl').
/*
facts for shopping
*/
item(potatoes).
item(bread).
item(coffee).
/*
Rules for shopping list
*/
choice(a):-listing(item), nl.
choice(b):-write('Enter an item: '),
read(Item),
assert(item(Item)).
choice(c):-write('Item to delete: '),
read(Item),
retract(item(Item)).
choice(_):-write('Incorrect entry.'), nl.
提前谢谢了,