|Did you know ...||Search Documentation:|
The predicates reset/3 and shift/1 implement delimited continuations for Prolog. Delimited continuation for Prolog is described in Schrijvers et al., 2013. The mechanism allows for proper coroutines, two or more routines whose execution is interleaved, while they exchange data. Note that coroutines in this sense differ from coroutines realised using attributed variables as described in chapter 7.
The suspension mechanism provided by delimited continuations is suitable for the implementation of tabling Desouter et al., 2015.
reset(Goal,Continuation,Ball). We swapped the argument order for compatibility with catch/3 shift/1 causes reset/3 to return, unifying Continuation with a goal that represents the continuation after shift/1. In other words, meta-calling Continuation completes the execution where shift it. If Goal does not call shift/1, both Ball and Continuation are unified with the integer