call is a built-in meta-predicate that allows its single
argument to be called/invoked as a goal. For
example, a program might create a goal (perhaps using
=..) on the fly, and then,
presumably later in the program, need to test the goal.
Here are queries that perform these roles - in a real
program, both the
assert and the
would be built in to Prolog procedures written by the programmer.
?- assert(likes(mary, pizza)).
?- call(likes(Person, pizza)).
Person = mary
?- Goal =.. [likes, mary, What], call(Goal).
Goal = likes(mary, pizza)
What = pizza