Did you know ... Search Documentation:
Pack delay -- prolog/delay.pl
PublicShow source
 univ(+Term, -Name, -Args) is det
univ(-Term, +Name, +Args) is det
Just like is like Term =.. [Name|Args]. This predicate is exported to placate the cross-referencer. It's intended to be called as delay(univ(T,N,As)). Although it can be used as a normal goal, if wanted.
 delay(:Goal)
Like call(Goal) but postpones execution until Goal's arguments are bound enough to avoid errors like: "Arguments are not sufficiently instantiated". This is currently realized with attributed variables and when/2, so execution timing is identical. For example,
t :-
    delay(atom_codes(A,C)),
    A = hello,
    C == "hello".

does not throw an exception on the first line. One is simply declaring that A and C have a given relationship without stating when the predicate (atom_codes/2) will execute. This declarative style is especially valuable when different modes of a predicate require different goal order.

The following predicates are currently supported:

delay(length(L,Len)) warrants additional explanation. length/2 doesn't throw instantiation exceptions. It simply iterates all possible lists and their respective lengths. This isn't always ideal. Using delay/1 with length/2 yields the same semantics but performs much less backtracking. It waits until either L or Len is bound then length/2 evaluates without any choicepoints. L must become a proper list to trigger, so incrementally binding its head is OK.

 when_proper_list(List, Goal)
Delay executing Goal until List becomes a proper list. This predicate is part of the internal implementation of delay/1 but it may be useful to others so it's exported.