Documentation Prolog Predicate Reference lists maplist/2

maplist/2

Check if goal can be applied to a list.

Description

maplist( :callable_term, ?list )

maplist(Goal, List) is true if and only if Goal can be successfully applied to List. If Goal fails for any of List's elements, maplist fails.

Examples

Example #1 Example of maplist/2

% even(X) :- 0 is X mod 2. ?- maplist(even, [2, 4, 6]). % true. ?- maplist(even, [2, 4, 5]). % false.

Implementation