예제 #1
0
 def __str__(self):
     result = 'Goal(term={0}, slot={1}) of cost {2}'.\
         format(fold_numbers(self.term), self.slot,
                self.cost())
     if self.gets:
         result += ', depends on {0}'.format(list(self.gets))
     if self.lazy_gets:
         result += ', lazily depends on {0}'.format(self.lazy_gets)
     return result
예제 #2
0
 def introduce_get(self, sub_term, register_access):
     g, register_slot = fold_numbers(register_access)
     assert isinstance(register_slot, int)
     assert g == cards.get
     
     self.gets.add(register_slot)
     
     if not is_subterm_eager(sub_term, self.term):
         self.lazy_gets.add(register_slot)
     self.term = replace_leaf_subterm(sub_term, register_access, self.term)