imprive python interface
This commit is contained in:
@@ -5,27 +5,28 @@
|
||||
|
||||
setup_dir :-
|
||||
prolog_load_context(directory, Dir),
|
||||
atom_concat(Dir,'/pyx/',Base),
|
||||
atom_concat(Dir,'pyx/',Base),
|
||||
assert(base(Base)).
|
||||
|
||||
:- setup_dir.
|
||||
|
||||
main :-
|
||||
python_import(pyx),
|
||||
ex(X),
|
||||
flush_output,
|
||||
fail.
|
||||
main.
|
||||
|
||||
ex(hello_world) :-
|
||||
c := pyx:canvas:canvas,
|
||||
ex(hello) :-
|
||||
c := canvas:canvas(_),
|
||||
:= $c:text(0, 0, 'Hello, world!'),
|
||||
:= $c:stroke(path:line(0, 0, 2, 0)),
|
||||
:= $c:writePDFfile('hello').
|
||||
|
||||
ex(changebar) :-
|
||||
g := pyx:graph:graphxy(width=8, x=graph:axis:bar),
|
||||
atomic_concat(Source, 'minimal.dat', Data),
|
||||
:= $g:plot(graph:data:file(Data, xname=0, y=2), [graph:style:changebar]),
|
||||
g := graph:graphxy(width=8, x=graph:axis:bar(_)),
|
||||
base(Source), atomic_concat(Source, 'minimal.dat', Data),
|
||||
:= $g:plot(graph:data:file(Data, xname=0, y=2), [graph:style:changebar(_)]),
|
||||
:= $g:writePDFfile(changebar).
|
||||
|
||||
|
||||
|
@@ -41,7 +41,7 @@ ex(home) :-
|
||||
).
|
||||
|
||||
ex(site) :-
|
||||
X := site:getusersitepackages,
|
||||
X := site:getusersitepackages(_),
|
||||
format('site packages=~a~n',[X]).
|
||||
|
||||
ex(arith) :-
|
||||
@@ -122,10 +122,10 @@ ex(lists) :-
|
||||
:= $a:remove(333),
|
||||
B := $a,
|
||||
format('a=~w~n', [B]),
|
||||
:= $a:reverse,
|
||||
:= $a:reverse(_),
|
||||
C := $a,
|
||||
format('a=~w~n', [C]),
|
||||
:= $a:sort,
|
||||
:= $a:sort(_),
|
||||
D := $a,
|
||||
format('a=~w~n', [D]).
|
||||
|
||||
|
Reference in New Issue
Block a user