more swig upddates.

This commit is contained in:
Vítor Santos Costa
2014-06-04 22:07:37 +01:00
parent a76b6d23dc
commit 3087d51b18
3 changed files with 65 additions and 10 deletions

View File

@@ -0,0 +1,20 @@
# python commands
import sys
import yap
engine = yap.YAPEngine();
# engine = yap.YAPEngine(yap.YAPParams());
def go():
while True:
s = raw_input("Prolog Query: ")
q = engine.query(s)
while q.next():
vs = q.namedVars();
while vs.length() > 0:
eq = vs.car()
print eq.text()
print eq.getArg(1).text() + " = " + eq.getArg(2).text()
vs = vs.cdr()
print "no more answers"