diff options
Diffstat (limited to 'prolog')
-rw-r--r-- | prolog/engine.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/prolog/engine.py b/prolog/engine.py index 2878933..f94a6ab 100644 --- a/prolog/engine.py +++ b/prolog/engine.py @@ -93,6 +93,9 @@ class PrologEngine(object): } self.err_flags = PL_Q_NODEBUG|PL_Q_CATCH_EXCEPTION + # Load the sandbox and compatibility library. + self.call('consult/1', [Term(Atom('prolog/lib.pl'))]) + # Increase memory limits. self.call('set_prolog_stack/2', [Term('global'), Term('limit(2*10**9)')]) self.call('set_prolog_stack/2', [Term('local'), Term('limit(2*10**9)')]) @@ -128,9 +131,6 @@ class PrologEngine(object): PL_cut_query(qid) return True - def consult(self, filename): - return self.call('consult/1', [Term(Atom(filename))]) - # Get up to [n] solutions to query [q]. def query(self, q, module=None, n=1): if module is not None: @@ -229,8 +229,6 @@ class PrologEngine(object): # Basic sanity check. if __name__ == '__main__': engine = PrologEngine() - engine.consult('prolog/lib.pl') - engine.load_solution(0, 'a(2). a(2). a(3). ') result = engine.test(0, 0, 'a(2). ', ['a(X)', 'a(Y), Y=X']) print('{}: {}'.format(i, result)) |