Documentation Prolog Predicate Reference lists maplist/4

maplist/4

Check if goal can be applied to several lists.

Description

maplist( :callable_term, ?list, ?list, ?list )

As in maplist/2, but operating three elements at a time from the three lists. In this case, the Goal will consume three elements each time, one from each list.

Examples

Example #1 Example of maplist/4

% mult(X,Y,Z) :- Z is X * Y. ?- maplist(mult, [1, 2, 3], [1, 2, 3], [1, 4, 9]). % true. ?- maplist(mult, [1, 2, 3], [1, 2, 3], [1, 4, 25]). % false. ?- maplist(mult, [1, 2, 3], [1, 2, 3], X). % X = [1, 4, 25].

Implementation