def apply_inf_list(self, a:Node.infinite, b:Node.infinite):
def apply_iterator(a, b):
a, a_copy = tee(a, 2)
b, b_copy = tee(b, 2)
yield self.run(next(a_copy), [next(b_copy)])
size = 1
while 1:
next_a = next(a_copy)
next_b = next(b_copy)
a, new_a = tee(a, 2)
b, new_b = tee(b, 2)
yield from (self.run(next(new_a), [next_b]) for i in range(size))
yield from (self.run(next_a, [next(new_b)]) for i in range(size))
yield self.run(next_a, [next_b])
size += 1
return DummyList(apply_iterator(a, b))
评论列表
文章目录