Did you know ... Search Documentation:
Pack pac -- prolog/pac/expand-pac.pl
PublicShow source
 regex(+W:regex, +S:string/codes, -S0:string/codes) is nondet
True if W is expand to qeury for parsing S (minus S0).
 bekind(+X) is det
Enable a kind block X.
 bekind(X:epac, O:options) is det
Enable a kind block X with options O.
 ekind is det
Disable kind block.
 betrs(+X) is det
Enable trs block X. betrs : BEgin of Term Rewriting System
 etrs is det
Disable trs block. etrs : End of Term Rewriting System
 befun is det
Enable a function declaration mode.
 expand_kind_rule(+K:kind, +L:term, +R:exp, -G:goal, -C:clause)
is semidet

True if a given kind (a named group of conditional equations) rule

(L = R :- G)

is converted to an equivelnt clause C.

Simplest usage:

 expand_pac(+X:clause, -Y:clause) is det
 expand_query(?M:module, +Q:goal, -Q0:goal) is det
Given top level query Q is expanded to Q0 at module M.
 expand_goal(+G:goal, +M:atom, -G0:goal, -P:list, -Q:list) is det
True if G is converted to G0 and the generated helper predicates in P (minus Q) so that G is equivalent to G0 with P (minus Q).

Simples usage: ?- pac:expand_goal((call(pred([a]), X), write(X)), user, G, L, []). G = (user:'pred#2'(X), user:write(X)), L = [ (user:'pred#2'(a) :- true)]

 expand_core(+Pac:pac, +M:atom, -G:pred, -P:list, -Q:list) is det
True if Pac is converted to a fresh predicate G in P (minus Q) at a module M.

Simplest usage: ?- expand_core(pred([X, Y] :- X\==Y), user, G, P, []). G = user:'pred#1', P = [ (user:'pred#1'(X, Y) :- user: (X\==Y))]

 expand_phrase(+G:phrase, +M:atom, -G0:phrase, -P:list, -Q:list) is det
True if G is converted to G0 and helper predicates in P (minus Q) at a module M.

Simplest usage: ?- expand_phrase((pred([X, f(X)]), pred(U, g(U))), user, G, L, []). G = (user:'pred#3', user:'pred#4'(U)), L = [ (user:'pred#3'(X, f(X)) :- true), (user:'pred#4'(U, g(U)):-true)] .

 eval(+E:exp, -V, +O:options) is det
Convert E to a goal G (see below) such that execution of G makes V be unified with the value.

options in O:

  • goal(G) : G is a goal whose execution gives the value V of the expression E.
  • pac(X-Y): generated helper predicates in the form of d-list X-Y.
  • inside_out(true/false) : if true given, subterms of E
    are evaluated recursively unless it is a expression with a kind prefix like <kind>::<expression>.
  • run(true/false): 'true' is default, and then run the goal G.
 expand_exp(+E:exp, +S:kind, -U:term, +M:module, -G:goal, -P:list, -Q:list)
is semidet

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 efun
 nopac(Arg1)
 eval(Arg1, Arg2)
 expand_arg(Arg1, Arg2, Arg3, Arg4, Arg5)
 expand_arg_assert(Arg1, Arg2)
 expand_arg_compile(Arg1, Arg2)
 expand_basic_phrase(Arg1, Arg2, Arg3, Arg4)
 expand_basic_phrase(Arg1, Arg2, Arg3, Arg4, Arg5)
 expand_exp(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)
 expand_fun(Arg1, Arg2)
 flip_list(Arg1, Arg2, Arg3)
 compile_kind_rule(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)
 goal_to_pred(Arg1, Arg2, Arg3, Arg4, Arg5)
 partial_args_match(Arg1, Arg2)
 phrase_to_pred(Arg1, Arg2, Arg3, Arg4, Arg5)