1def tips_unfold(fn, seed):
2 def fn_generator(val):
3 while True:
4 val = fn(val[1])
5 if val == False: break
6 yield val[0]
7 return [i for i in fn_generator([None, seed])]
8
9f = lambda n: False if n > 50 else [-n, n + 10]
10print(tips_unfold(f, 10))
11