Prolog Language Higher-Order Programming maplist/[2,3]


maplist/2 and maplist/3 are higher-order predicates, which allow the definition of a predicate to be lifted about a single element to lists of such elements. These predicates can be defined using call/2 and call/3 as building blocks and ship with many Prolog systems.

For example:

?- maplist(dif(a), [X,Y,Z]).
dif(X, a),
dif(Y, a),
dif(Z, a).