Commits

Pierre Carbonnelle committed b3a8038

Minor changes

Comments (0)

Files changed (2)

pyDatalog/pyEngine.py

     Stack[-1][1].appendleft(Thunk(post_thunk)) 
     
 
-def invoke(thunk):
+def invoke(subgoal):
     """ Invoke the tasks. Each task may append new tasks on the schedule."""
     global tasks, subgoals
+    thunk = lambda subgoal=subgoal: search(subgoal)
     tasks = deque([Thunk(thunk),])
     while tasks or Stack:
         while tasks:
     subgoals = {}
     subgoal = Subgoal(literal)
     merge(subgoal)
-    invoke(lambda subgoal=subgoal: search(subgoal))
+    invoke(subgoal)
     subgoals = None
     if subgoal.facts is True:
         return True

pyDatalog/pyParser.py

         
     def __invert__(self):
         """unary ~ means negation """
-        # TODO test with python queries
         return Literal.make('~' + self.predicate_name, self.terms) #pred
 
     def __and__(self, other):
             if arg is None or (isinstance(arg, tuple) and arg == tuple()):
                 raise util.DatalogError("Error: argument missing in aggregate", None, None)
         
-        # used to create literal. TODO : filter on symbols
+        # used to create literal.
         self.args = ((Y,) if Y is not None else tuple()) + self.for_each + self.order_by + ((sep,) if sep is not None else tuple())
         self.Y_arity = 1 if Y is not None else 0
         self.sep_arity = 1 if sep is not None else 0