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/packages/swig/python/demo.py

23 lines
554 B
Python
Raw Normal View History

2014-06-04 22:07:37 +01:00
# python commands
import sys
import yap
engine = yap.YAPEngine();
# engine = yap.YAPEngine(yap.YAPParams());
def go():
while True:
s = raw_input("Prolog Query: ")
2015-02-09 01:53:28 +00:00
q = engine.query(s)
2014-06-04 22:07:37 +01:00
while q.next():
vs = q.namedVars();
2015-02-09 01:53:28 +00:00
if vs.length() == 0:
print "yes"
else:
while vs.length() > 0:
eq = vs.car()
print eq.getArg(1).text() + " = " + eq.getArg(2).text()
vs = vs.cdr()
2014-06-11 19:31:24 +01:00
print "no more answers"