Meta call predicates are used to call terms constructed at run time. The basic meta-call mechanism offered by SWI-Prolog is to use variables as a subclause (which should of course be bound to a valid goal at runtime). A meta-call is slower than a normal call as it involves actually searching the database at runtime for the predicate, while for normal calls this search is done at compile time.
will call plus/3, binding X to 3.
The call/[2..] construct is handled by the compiler, which implies that redefinition as a predicate has no effect. The predicates call/[2-6] are defined as true predicates, so they can be handled by interpreted code.
\+/1
.
once(Goal) :- Goal, !.O nce/1 can in many cases be replaced with
->/2
. The only
difference is how the cut behaves (see !/0). The following two clauses
are identical:
1) a :- once((b, c)), d. 2) a :- b, c -> d.
ignore(Goal) :- Goal, !. ignore(_).