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/pl/tabling.yap
vsc e5f4633c39 This commit was generated by cvs2svn to compensate for changes in r4,
which included commits to RCS files with non-trunk default branches.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@5 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2001-04-09 19:54:03 +00:00

89 lines
3.3 KiB
Prolog

/*************************************************************************
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* *
**************************************************************************
* *
* File: tabling.yap *
* Last rev: 8/2/88 *
* mods: *
* comments: support tabling predicates *
* *
*************************************************************************/
table(X) :- var(X), !,
write(user_error, '[ Error: argument to table/1 should be a predicate ]'),
nl(user_error),
fail.
table((A,B)) :- !, table(A), table(B).
table(A/N) :- integer(N), atom(A), !,
functor(T,A,N), $flags(T,F,F),
(
X is F /\ 8'000100, X =\= 0, !,
write(user_error, '[ Warning: '),
write(user_error, A/N),
write(user_error, ' is already declared as table ]'),
nl(user_error)
;
X is F /\ 8'170000, X =:= 0, !, $table(T)
;
write(user_error, '[ Error: '),
write(user_error, A/N),
write(user_error, ' cannot be declared as table ]'),
nl(user_error),
fail
).
table(X) :- write(user_error, '[ Error: '),
write(user_error, X),
write(user_error, ' is an invalid argument to table/1 ]'),
nl(user_error),
fail.
show_trie(X) :- var(X), !,
write(user_error, '[ Error: argument to trie/1 should be a predicate ]'),
nl(user_error),
fail.
show_trie(A/N) :- integer(N), atom(A), !,
functor(T,A,N), $flags(T,F,F),
(
X is F /\ 8'000100, X =\= 0, !, $show_trie(T)
;
write(user_error, '[ Error: '),
write(user_error, A/N),
write(user_error, ' is not declared as table ]'),
nl(user_error),
fail
).
show_trie(X) :- write(user_error, '[ Error: '),
write(user_error, X),
write(user_error, ' is an invalid argument to trie/1 ]'),
nl(user_error),
fail.
abolish_trie(X) :- var(X), !,
write(user_error, '[ Error: argument to abolish_trie/1 should be a predicate ]'),
nl(user_error),
fail.
abolish_trie(A/N) :- integer(N), atom(A), !,
functor(T,A,N), $flags(T,F,F),
(
X is F /\ 8'000100, X =\= 0, !, $abolish_trie(T)
;
write(user_error, '[ Error: '),
write(user_error, A/N),
write(user_error, ' is not declared as table ]'),
nl(user_error),
fail
).
abolish_trie(X) :- write(user_error, '[ Error: '),
write(user_error, X),
write(user_error, ' is an invalid argument to abolish_trie/1 ]'),
nl(user_error),
fail.