jupyter
This commit is contained in:
@@ -79,16 +79,14 @@ python_query( Caller, String, Bindings ) :-
|
||||
output(Caller, Bindings).
|
||||
|
||||
output( Caller, Bindings ) :-
|
||||
fail,
|
||||
Answer := {},
|
||||
% start_low_level_trace,
|
||||
Caller.answer := {},
|
||||
/* % start_low_level_trace,
|
||||
foldl(ground_dict(answer), Bindings, [], Ts),
|
||||
term_variables( Ts, Hidden),
|
||||
foldl(bv, Hidden , 0, _),
|
||||
maplist(into_dict(Answer),Ts),
|
||||
Caller.answer := Answer,
|
||||
fail.
|
||||
|
||||
*/ maplist(into_dict(answer),Bindings),
|
||||
:= print(answer)},
|
||||
Caller.answer := answer.
|
||||
|
||||
output( _, Bindings ) :-
|
||||
write_query_answer( Bindings ),
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import readline
|
||||
import copy
|
||||
from yap4py.yap import *
|
||||
from yap4py.systuples import *
|
||||
from os.path import join, dirname
|
||||
@@ -76,11 +77,10 @@ class Query (YAPQuery):
|
||||
return self.port == "fail" or self.port == "exit"
|
||||
|
||||
def __next__(self):
|
||||
self.answer = {}
|
||||
if self.port == "fail" or self.port == "exit":
|
||||
raise StopIteration()
|
||||
if self.next():
|
||||
return self.answer
|
||||
return copy.deepcopy(self.answer)
|
||||
raise StopIteration()
|
||||
|
||||
def name( name, arity):
|
||||
|
Reference in New Issue
Block a user