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
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)
def getvalue(self, env): return getvalue(self.value, env) def setvalue(self, value): self.var.setvalue(value)
def getvalue(self, env): binding = env[self] if binding is self: return binding return getvalue(binding, env)
def getvalue(self, env): result = self.deref(env) if not isinstance(result, Var): result = getvalue(result, env) return result