[Up] [Contents] [Index] [Summary]

4.9.1 Emulating meta_predicate/1

The Quintus meta_predicate/1 directive can in many cases be replaced by the transparent declaration. Below is the definition of meta_predicate/1 as available from library(quintus).

:- op(1150, fx, (meta_predicate)). meta_predicate((Head, More)) :- !, meta_predicate1(Head), meta_predicate(More). meta_predicate(Head) :- meta_predicate1(Head). meta_predicate1(Head) :- Head =.. [Name|Arguments], member(Arg, Arguments), module_expansion_argument(Arg), !, functor(Head, Name, Arity), module_transparent(Name/Arity). meta_predicate1(_). % just a mode declaration module_expansion_argument(:). module_expansion_argument(N) :- integer(N).

The discussion above about the problems with the transparent mechanism show the two cases in which this simple transformation does not work.