From 5db8e25735016fa84bc7a56579bc255965a86d87 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Sun, 31 Jul 2016 10:33:20 -0500 Subject: [PATCH] must be early for boot --- pl/bootutils.yap | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pl/bootutils.yap diff --git a/pl/bootutils.yap b/pl/bootutils.yap new file mode 100644 index 000000000..a5f1e6c9a --- /dev/null +++ b/pl/bootutils.yap @@ -0,0 +1,36 @@ +/** @pred recordaifnot(+ _K_, _T_,- _R_) + + +If a term equal to _T_ up to variable renaming is stored under key + _K_ fail. Otherwise, make term _T_ the first record under key + _K_ and unify _R_ with its reference. + + +*/ +recordaifnot(K,T,R) :- + recorded(K,T,R), % force non-det binding to R. + '$still_variant'(R,T), + !, + fail. +recordaifnot(K,T,R) :- + recorda(K,T,R). + +/** @pred recordzifnot(+ _K_, _T_,- _R_) + + +If a term equal to _T_ up to variable renaming is stored under key + _K_ fail. Otherwise, make term _T_ the first record under key + _K_ and unify _R_ with its reference. + +This predicate is YAP specific. + + +*/ +recordzifnot(K,T,R) :- + recorded(K,T,R), + '$still_variant'(R,T), + !, + fail. +recordzifnot(K,T,R) :- + recordz(K,T,R). +