% 14th Feb 2000. New (std?) version. % taken from pfdm_library.pl % maplist(+GoalName, +InList, -OutList) % % Succeeds when the arity 2 Goal succeeds for each corresponding pair % of arguments taken from InList and OutList respectively. maplist(_, [], []). maplist(GoalName, [In | RestIn], [Out | RestOut]) :- functor(Goal, GoalName, 2), arg(1, Goal, In), arg(2, Goal, Out), Goal, maplist(GoalName, RestIn, RestOut). maplist(GoalName, [In | RestIn], [Out | RestOut], Extras ) :- !, Goal =.. [GoalName,In,Out|Extras], Goal, maplist(GoalName, RestIn, RestOut, Extras). maplist(_, [], [], _Extras).