Created
January 13, 2022 02:13
-
-
Save FernandoCutire/792cef7987f2fd5f4968e210512e1bbf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def unfold(fn, seed): | |
def fn_generator(val): | |
while True: | |
val = fn(val[1]) | |
if val == False: break | |
yield val[0] | |
return [i for i in fn_generator([None, seed])] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment