[ library(apply) | Reference Manual | Alphabetic Index ]

apply(?Term, ?Args)

The apply/2 higher-order predicate
Term
An atom or compound term
Args
A list of arbitrary terms

Description

Invokes a goal that is formed by appending the elements of the list Args as additional arguments to Term.

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Examples

    % The following three examples all invoke the goal plus(1,2,X):

    ?- apply(plus, [1,2,X]).
    X = 3

    ?- apply(plus(1), [2,X]).
    X = 3

    ?- apply(plus(1,2), [X]).
    X = 3


    % Error:

    ?- apply(plus(1),[2]).
    calling an undefined procedure plus(1, 2) in module eclipse
    Abort