missing
This commit is contained in:
parent
d680fa0755
commit
da315b2688
33
packages/swig/python/yapy.py
Normal file
33
packages/swig/python/yapy.py
Normal file
@ -0,0 +1,33 @@
|
||||
# python commands
|
||||
|
||||
import sys
|
||||
import yap
|
||||
|
||||
#
|
||||
# initialize engine
|
||||
engine = yap.YAPEngine();
|
||||
# engine = yap.YAPEngine(yap.YAPParams());
|
||||
|
||||
def query( s ):
|
||||
q = engine.query(s)
|
||||
while q.next():
|
||||
vs = q.namedVars()
|
||||
if vs.length() == 0:
|
||||
print( "yes" )
|
||||
return
|
||||
else:
|
||||
while vs.length() > 0:
|
||||
eq = vs.car()
|
||||
print( eq.getArg(1).text() + " = " + eq.getArg(2).text() )
|
||||
vs = vs.cdr()
|
||||
s = raw_input("next: ?")
|
||||
if s.find(';') != 0 :
|
||||
return
|
||||
print( "no more answers" )
|
||||
return
|
||||
|
||||
def live():
|
||||
loop = True
|
||||
while loop:
|
||||
s = raw_input("?- ")
|
||||
query( s )
|
Reference in New Issue
Block a user