:- import(prolog_types).

%%% rk: principle construction of meta_types:
%%% :- type meta(Apply_Kind(Typepars) of Meta_Kind).
%%% Apply_Kind --> trmName; trmFull.
%%% Meta_Kind  --> mpred; mfunc; mtype(TargetType); mall.
%%% Typepar(s) --> type-parameter(s) of predicate- or function-declaration
%%% TargetType --> target-type of function-declaration
%%% The giving of Apply_Kind, Meta_Kind or Typepar(s) is optional.
%%% The of-operator is necessary, if Apply_Kind and Meta_Kind are given.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% The syntactic kernel of Prolog  (and StdP)
:- pred {goal :- goal}.         %  e.g., used in assert((head:-body))
:- pred {:- goal}.              %  e.g., used in transform/4 %%% rk
:- pred {?- goal}.              %  e.g., used in transform/4 %%% rk
:- pred {goal,goal}.            %  , = conjunction     
:- pred {goal;goal}.            %  ; = disjunction
:- pred {goal->goal}.           %  -> = if-then
:- pred !.
:- pred \+ goal.
:- pred not(goal).




...

%---------

:- pred fcall(meta((trmFull([]) of mpred))).
:- pred fcall(meta((trmName([T]) of mpred)), T).
:- pred fcall(meta((trmName([T1,T2]) of mpred)), T1, T2).
:- pred fcall(meta((trmName([T1,T2,T3]) of mpred)), T1, T2, T3).
:- pred fcall(meta((trmName([T1,T2,T3,T4]) of mpred)), T1,T2,T3,T4).
:- pred fcall(meta((trmName([T1,T2,T3,T4,T5]) of mpred)), T1,T2,T3,T4,T5).
:- pred fcall(meta((trmName([T1,T2,T3,T4,T5,T6]) of mpred)), T1,T2,T3,T4,T5,T6).
:- pred fcall(meta((trmName([T1,T2,T3,T4,T5,T6,T7]) of mpred)), 
                T1,T2,T3,T4,T5,T6,T7).
:- pred fcall(meta((trmName([T1,T2,T3,T4,T5,T6,T7,T8]) of mpred)), 
                T1,T2,T3,T4,T5,T6,T7,T8).
:- pred fcall(meta((trmName([T1,T2,T3,T4,T5,T6,T7,T8,T9]) of mpred)), 
                T1,T2,T3,T4,T5,T6,T7,T8,T9).
:- pred fcall(meta((trmName([T1,T2,T3,T4,T5,T6,T7,T8,T9,TA]) of mpred)), 
                T1,T2,T3,T4,T5,T6,T7,T8,T9,TA).

:- pred flcall(meta((trmName of mpred)), list(T)).


%-----------------------------------------------------------------------------

% from typeops_meta

fcall(P) :- atom(P), P.
fcall(P,A) :- atom(P),
	Gterm =.. [P,A],
	Gterm.
fcall(P,A,B) :- atom(P),
	Gterm =.. [P,A,B],
	Gterm.
fcall(P,A,B,C) :- atom(P),
	Gterm =.. [P,A,B,C],
	Gterm.
fcall(P,A,B,C,D) :- atom(P),
	Gterm =.. [P,A,B,C,D],
	Gterm.
fcall(P,A,B,C,D,E) :- atom(P),
	Gterm =.. [P,A,B,C,D,E],
	Gterm.
fcall(P,A,B,C,D,E,F) :- atom(P),
	Gterm =.. [P,A,B,C,D,E,F],
	Gterm.
fcall(P,A,B,C,D,E,F,G) :- atom(P),
	Gterm =.. [P,A,B,C,D,E,F,G],
	Gterm.
fcall(P,A,B,C,D,E,F,G,H) :- atom(P),
	Gterm =.. [P,A,B,C,D,E,F,G,H],
	Gterm.
fcall(P,A,B,C,D,E,F,G,H,I) :- atom(P),
	Gterm =.. [P,A,B,C,D,E,F,G,H,I],
	Gterm.
fcall(P,A,B,C,D,E,F,G,H,I,J) :- atom(P),
	Gterm =.. [P,A,B,C,D,E,F,G,H,I,J],
	Gterm.

flcall(P,ParList) :- atom(P),
	Gterm =.. [P | ParList],
	Gterm.

