How to write/edit own coroutines in Prolog?
问题 I would like to build my own coroutines in Prolog. I'd like to add some extra functionalities. 回答1: One possible solution would be to use the term-expansion mechanism provided by some Prolog systems and Logtalk to rewrite calls to e.g. the freeze/2 predicate to do the extra steps you want. One must be careful, however, to not expand a call to a predicate into another goal that calls the same predicate as goal-expansion is recursively applied until a fixed-point is reached. The Logtalk