Last active
July 7, 2018 23:50
-
-
Save Spuffynism/0e92acc457affc1f46b4e455e5274712 to your computer and use it in GitHub Desktop.
Codegolfing generators
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
// recursive infinite generator | |
p=function*a(x){yield x;yield*a(x+1)}(0) | |
o={*a(x){yield x;yield*this.a(x+1)}}.a(0) | |
// using iterators | |
q=(x=>({next:_=>({value:x++})}))(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment