Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fibonacci numbers issue #120

Open
eidicon opened this issue Sep 3, 2018 · 0 comments
Open

Fibonacci numbers issue #120

eidicon opened this issue Sep 3, 2018 · 0 comments

Comments

@eidicon
Copy link

eidicon commented Sep 3, 2018

Hi there! First, I want to say thanks for a great features overview.
GeneratorFunctionIteratorProtocol good as example of generator but not fully correct Fibonacci numbers.
An output of this example is 1, 2, 3, 5, 8, 13 ...
And should be: 1, 1, 2, 3, 5, 8, 13
Yield can be placed before calculating the next iteration.

...
for (;;) {
    yield cur;
    [ pre, cur ] = [ cur, pre + cur ]
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant