是否有可能在SWI Prolog中定义一个类似于Sicstus Prolog中的undo谓词?从西克斯都的描述中:
undo(:Goal)
The goal call(Goal) (see section Control) is executed on backtracking. This predicate is useful if the Goal performs some side-effect that must be done on backtracking to undo another side-effect.SWI谓词setup_call_cleanup不会这样做,因为它会立即进行清理,而不是等到回溯。
发布于 2020-12-28 15:32:43
你怎么看待这个叫做回溯的目标:
undo(Goal) :- true.
undo(Goal) :- call(Goal).我没有权限接近西克图。
https://stackoverflow.com/questions/65467657
复制相似问题