Arguments are reordered to gain performance as well as to make the predicate deterministic under normal circumstances.
What does this mean exactly? Does it mean maplist/2 can run Goal on the list items in arbitrary order? That’s certainly nice in case you have a Prolog Processor than can do actual parallelism (where’s my 5th Generation machine?), but it precludes using maplist/2 to output a list of messages in-order or to pull in a list of strings via read/1 in-order.
Look at the implementation. As far as I understand this only refers to one thing:
In the head of the exported predicate, the argument order is Goal, List. This is swapped so that in the implementation (see here) the order is List, Goal. This means that the first argument to the two clauses of maplist_ is either [] or [_|_]; in SWI-Prolog this makes the predicate deterministic.
Could someone (jan?) alter the pldoc so that said text is shown when one looks at the source?
Also, maybe add “the list items are processed sequentially in order” (Although one may want to not give that guarantee and provide a separate maplist_sequential instead? Who knows whether Parlog becomes hot again?)
Rewrote the docs in the style of the more recent fold family as:
Availability: :- use_module(library(apply)). (can be autoloaded)
maplist(:Goal, ?List1)
maplist(:Goal, ?List1, ?List2)
maplist(:Goal, ?List1, ?List2, ?List3)
maplist(:Goal, ?List1, ?List2, ?List3, ?List4)
True if Goal is successfully applied on all matching elements of
the list. The maplist family of predicates is defined as:
maplist(P, [X11,...,X1n], ..., [Xm1,...,Xmn]) :-
P(X11, ..., Xm1),
...
P(X1n, ..., Xmn).
This family of predicates is deterministic iff Goal is
deterministic and List1 is a proper list, i.e., a list that ends
in [].