Skip to content

Commit 01cb8cf

Browse files
authored
Fix Fibonacci sequence in range-over-iterators (#643)
https://en.wikipedia.org/wiki/Fibonacci_sequence#Definition
1 parent a28b91c commit 01cb8cf

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

examples/range-over-iterators/range-over-iterators.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (lst *List[T]) All() iter.Seq[T] {
5757
// running as long as `yield` keeps returning `true`.
5858
func genFib() iter.Seq[int] {
5959
return func(yield func(int) bool) {
60-
a, b := 1, 1
60+
a, b := 0, 1
6161

6262
for {
6363
if !yield(a) {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
80571e7bb21ff847addac0ea92b3ddf86be86cb6
2-
JsdFcZac4E-
1+
112b0647ae7ef1e4f39d941626921d18ba5fa628
2+
5_fyZQZSn3S

examples/range-over-iterators/range-over-iterators.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ $ go run range-over-iterators.go
33
13
44
23
55
all: [10 13 23]
6+
0
67
1
78
1
89
2

public/range-over-iterators

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)