Prolog Delay: LIFO or FIFO Awakening?

Many Prolog systems have the predicate freeze/2 , a predicate that should be called geler/2 , since it was even invented before Prolog-II.

Suppose I have a condition for the same variable, but two different goals, i.e.:

  ?- freeze(X, G1), freeze(X, G2), X=1. 

What is the preferred waking strategy, is G1 first executed, or G2 is first executed? What to do if G1 and G2 cause new hangs that are also awakened:

  G1 :- freeze(Y, G3), Y=1. G2 :- freeze(Z, G4), Z=1. 

Is G3 or G4 always executed between G1 and G2, or can it be that G3 or G4 is executed after G1 and G2, or even after some time?

Bye

+6
source share

All Articles