A.2 library(apply): Apply predicates on a list

See also
- apply_macros.pl provides compile-time expansion for part of this library.
- http://www.cs.otago.ac.nz/staffpriv/ok/pllib.htm
To be done
Add include/4, include/5, exclude/4, exclude/5

This module defines meta-predicates that apply a predicate on all members of a list.

[det]include(:Goal, +List1, ?List2)
Filter elements for which Goal succeed. True if List2 contains those elements Xi of List1 for which call(Goal, Xi) succeeds.
See also
Older versions of SWI-Prolog had sublist/3 with the same arguments and semantics.
[det]exclude(:Goal, +List1, ?List2)
Filter elements for which Goal fails. True if List2 contains those elements Xi of List1 for which call(Goal, Xi) fails.
[det]partition(:Pred, +List, ?Included, ?Excluded)
Filter elements of List according to Pred. True if Included contains all elements for which call(Pred, X) succeeds and Excluded contains the remaining elements.
[semidet]partition(:Pred, +List, ?Less, ?Equal, ?Greater)
Filter list according to Pred in three sets. For each element Xi of List, its destination is determined by call(Pred, Xi, Place), where Place must be unified to one of <, = or >. Pred must be deterministic.
maplist(:Goal, ?List)
True if Goal can succesfully be applied on all elements of List. Arguments are reordered to gain performance as well as to make the predicate deterministic under normal circumstances.
maplist(:Goal, ?List1, ?List2)
True if Goal can succesfully be applied to all succesive pairs of elements of List1 and List2.
maplist(:Goal, ?List1, ?List2, ?List3)
True if Goal can succesfully be applied to all succesive triples of elements of List1..List3.
maplist(:Goal, ?List1, ?List2, ?List3, List4)
True if Goal can succesfully be applied to all succesive quadruples of elements of List1..List4