Skip to content

Instantly share code, notes, and snippets.

@nikhedonia
Last active November 9, 2018 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhedonia/c81af322d345ae6512df0dfff367d408 to your computer and use it in GitHub Desktop.
Save nikhedonia/c81af322d345ae6512df0dfff367d408 to your computer and use it in GitHub Desktop.
auto fib() -> seq<int> {
  int a = 0;
  int b = 1;
 
  while (1) {
  co_yield a;
  tie(a, b) = tuple{b, a+b};
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment