Documentation Prolog Predicate Reference lists maplist/3

maplist/3

Check if goal can be applied to several lists.

Description

maplist( :callable_term, ?list, ?list )

As in maplist/2, but operating on pairs of elements from the two lists. In this case, the Goal will consume a couple of elements each time, one from each list.

Examples

Example #1 Example of maplist/3

% succ(X, Y) :- Y is X + 1. ?- maplist(succ, [2, 4, 6], [3, 5, 7]). % true. ?- maplist(succ, [2, 4, 6], [3, 5, 8]). % false. ?- maplist(succ, [2, 4, 6], X). % X = [3, 5, 7].

Implementation