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):
|
class YAPKernel(IPythonKernel):
|
||||||
implementation = 'MetaKernel YAP'
|
implementation = 'YAP Kernel'
|
||||||
implementation_version = '1.0'
|
implementation_version = '1.0'
|
||||||
language = 'text'
|
language = 'text'
|
||||||
language_version = '0.1'
|
language_version = '0.1'
|
||||||
@ -88,6 +88,7 @@ class YAPKernel(IPythonKernel):
|
|||||||
else:
|
else:
|
||||||
i = bind.numberVars(i, True)
|
i = bind.numberVars(i, True)
|
||||||
print(name.text() + " = " + bind.text())
|
print(name.text() + " = " + bind.text())
|
||||||
|
else:
|
||||||
print("yes")
|
print("yes")
|
||||||
if self.q.deterministic():
|
if self.q.deterministic():
|
||||||
self.closeq()
|
self.closeq()
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import yap
|
import yap
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -75,8 +76,9 @@ def live():
|
|||||||
except:
|
except:
|
||||||
print("Unexpected error:", sys.exc_info()[0])
|
print("Unexpected error:", sys.exc_info()[0])
|
||||||
raise
|
raise
|
||||||
|
engine.close()
|
||||||
#
|
#
|
||||||
# initialize engine
|
# initialize engine
|
||||||
# engine = yap.YAPEngine();
|
# engine = yap.YAPEngine();
|
||||||
# engine = yap.YAPEngine(yap.YAPParams());
|
# engine = yap.YAPEngine(yap.YAPParams());
|
||||||
|
live()
|
||||||
|
Reference in New Issue
Block a user