【发布时间】:2011-12-15 04:05:19
【问题描述】:
我在 prolog 中有一个数据库,我想做的就是枚举它的元素并一一打印。如何做到这一点?
fact(is(mike,asthmatic)).
fact(has(andy,highPressure)).
fact(is(mike,smoker)).
我已经写了这个,它工作正常,但是它从数据库中删除了元素,所以我想访问它们而不删除。
print:-
retract(factA(P)),
write(factA(P)),nl,
fail.
print.
【问题讨论】:
-
如果你不想删除,那就不要打电话给
retract/1...
标签: prolog