Пример #1
0
 def memo_result_cont(value, solver):
   result_head = getvalue(values, solver.env)
   result = result_head, solver.parse_state, value
   solver.sign_state2results.setdefault(sign_state, []).append(result)
   # TODO: prevent backtracking for greedy
   for _, c in sign_state2cont:
     yield c, value
Пример #2
0
 def getvalue(self, env):
   head = getvalue(self.head, env)
   tail = getvalue(self.tail, env)
   if head==self.head and tail==self.tail:
     return self
   return Cons(head, tail)
Пример #3
0
 def getvalue(self, env): return getvalue(self.value, env)
 def setvalue(self, value): self.var.setvalue(value)
Пример #4
0
 def getvalue(self, env):
   binding = env[self]
   if binding is self: return binding
   return getvalue(binding, env)
Пример #5
0
 def getvalue(self, env):
   result = self.deref(env)
   if not isinstance(result, Var): 
     result = getvalue(result, env)
   return result