next up previous contents
Next: The Problem of Up: Some Useful Predicates Previous: repeat/0

call/1

The goal call(X) will call the interpreter as if the system were given the goal X. Therefore X must be bound to a legal Prolog goal.

 
?- call(write(hello)).

hello

yes

To handle a query which has multiple goals then:
 
?- call((write(hello),nl)).

hello

yes

Note that we cannot write call(write(hello),nl) as this would be taken to be a usage of call/2 with the first argument write(hello) and the second argument nl) ---and most systems do not have a call/2.

Note that call/1 is unusual in that its argument must be a legitimate Prolog goal. Also note that call(X) will be legal if and only if X is bound to a legal goal.



Paul Brna
Mon May 24 20:14:48 BST 1999