Co-Routining

Prolog uses a simple left-to-right flow of control.

It is sometimes convenient to change this control so that goals will only execute when sufficiently instantiated. This may result in a more "data-driven" execution, or may be necessary to correctly implement extensions such as negation by failure.

Initially, YAP used a separate mechanism for co-routining. Nowadays, YAP uses attributed variables to implement co-routining.