Qcompile for begin-end blocked macros

Hi Discourse,

I am very much satisfied with recent qcompiling functions.
In fact I have replaced almost all qsaved states versions
with qcompile ones.

Although almost everything is file as for me,
but some qcompiled predicates expanded by term_expansion
for block macros with begin-end gets undefined which is qcompiled
by this:

?- [misc(zdd)].

However the following works around without problem.

?- qcompile(misc(zdd)).

Also does deleting the zdd.qfl file before.

I may miss something simple about qcompiling. Any help is
appreciated.

The above mentioned block macros look like this:

:- bekind(zmatrix, []).
matrix(Dim, Init) =
xargs([OutMatrix] :-
create_matrix(Dim, OutMatrix, Init)).
tr(A) = :transpose_matrix@A.
A + B = :add_matrix_matrix@A@B.
A * B = :mul_matrix_matrix@A@B.
closure(A, N) = :path_join_power_series(K)@A :- K is N.
X = `X.
:- ekind.

% ?- listing(zmatrix).
%@ zmatrix(matrix(A, C), B) :-
%@ !,
%@ create_matrix(A, B, C).
%@ zmatrix(tr(A), C) :-
%@ !,
%@ zmatrix(A, B),
%@ transpose_matrix(B, C).
%@ zmatrix(A+B, E) :-
%@ !,
%@ zmatrix(A, C),
%@ zmatrix(B, D),
%@ add_matrix_matrix(C, D, E).
%@ zmatrix(A*B, E) :-
%@ !,
%@ zmatrix(A, C),
%@ zmatrix(B, D),
%@ mul_matrix_matrix(C, D, E).
%@ zmatrix(closure(B, A), E) :-
%@ C is A,
%@ !,
%@ zmatrix(B, D),
%@ path_join_power_series(C, D, E).
%@ zmatrix(A, A) :-
%@ !.
%@
%@ true.

Kuniaki Mukai

Hard to tell. There is one simple rule for qcompile though: you cannot use assert, except for local computation. I.e., anything you assert won’t be there if you load the qlf into a new Prolog instance. Otherwise, qlf files are basically just a record of the expanded and compiled code, including directives.

jan

    February 22

Hard to tell. There is one simple rule for qcompile though: you cannot use assert, except for local computation. I.e., anything you assert won’t be there if you load the qlf into a new Prolog instance. Otherwise, qlf files are basically just a record of the expanded and compiled code, including directives.

Thanks Jan,

Fortunately, my case seems to fall in your “local computation” category.

So I resume using block macros, though I should be careful anyway.

Kuniaki Mukai