This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/regression/modules/runmeta.yap

39 lines
630 B
Prolog

:- source.
:- [library(ytest)].
:- [library(hacks)].
:- [meta_tests].
meta_expand( Clause, Canon) :-
source_module(M),
indicator( M:Clause, I, _J),
dynamic( I ),
assert(Clause, R),
clause(J, B, R),
fully_strip_module(J, MH, H),
( MH == M
->
HF = H
;
HF = MH:H
),
( B == true
->
Canon = HF
;
Canon = ( HF :- B )
),
erase(R).
indicator(MC, HM:N/A, HM:G0) :-
fully_strip_module(MC, M, C),
( C = ( H:- _) -> true ; C = H),
fully_strip_module(M:H, HM, HF),
functor(HF, N, A),
functor(G0, N, A).
:- initialization run_tests.