python swig work
This commit is contained in:
parent
c58064bd0b
commit
b2156aad2d
3
packages/python/__init__.py
Normal file
3
packages/python/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
"""A Prolog kernel for Jupyter"""
|
||||
|
||||
__version__ = '0.0.1'
|
3
packages/python/__main__.py
Normal file
3
packages/python/__main__.py
Normal file
@ -0,0 +1,3 @@
|
||||
if __name__ == '__main__':
|
||||
from yapkernel import kernelapp as app
|
||||
app.launch_new_instance()
|
10
packages/python/examples/plot.py
Normal file
10
packages/python/examples/plot.py
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
:- [library(python)].
|
||||
|
||||
main :-
|
||||
:= import matplotlib.pyplot,
|
||||
:= Plt = ematplotlib.pyplot,
|
||||
Plt.plot([1,2,3,4]),
|
||||
Plt.ylabel(`some numbers`),
|
||||
Plt.show().
|
||||
|
1
packages/python/pytils.yap
Normal file
1
packages/python/pytils.yap
Normal file
@ -0,0 +1 @@
|
||||
|
@ -23,7 +23,7 @@ def eprint(*args, **kwargs):
|
||||
|
||||
|
||||
class YAPKernel(IPythonKernel):
|
||||
implementation = 'MetaKernel YAP'
|
||||
implementation = 'YAP Kernel'
|
||||
implementation_version = '1.0'
|
||||
language = 'text'
|
||||
language_version = '0.1'
|
||||
@ -88,7 +88,8 @@ class YAPKernel(IPythonKernel):
|
||||
else:
|
||||
i = bind.numberVars(i, True)
|
||||
print(name.text() + " = " + bind.text())
|
||||
print("yes")
|
||||
else:
|
||||
print("yes")
|
||||
if self.q.deterministic():
|
||||
self.closeq()
|
||||
return
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
import yap
|
||||
import sys
|
||||
|
||||
@ -50,8 +51,8 @@ def query_prolog(engine, s):
|
||||
ask = False
|
||||
else:
|
||||
break
|
||||
print("No (more) answers")
|
||||
q.close()
|
||||
print("No (more) answers")
|
||||
q.close()
|
||||
return
|
||||
|
||||
|
||||
@ -75,8 +76,9 @@ def live():
|
||||
except:
|
||||
print("Unexpected error:", sys.exc_info()[0])
|
||||
raise
|
||||
|
||||
engine.close()
|
||||
#
|
||||
# initialize engine
|
||||
# engine = yap.YAPEngine();
|
||||
# engine = yap.YAPEngine(yap.YAPParams());
|
||||
live()
|
||||
|
Reference in New Issue
Block a user