Skip to content

Commit

Permalink
Small tweaks to the sample
Browse files Browse the repository at this point in the history
  • Loading branch information
eliben committed Aug 21, 2024
1 parent 2f31c1f commit 4d27fb5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions examples/range-over-custom-types/range-over-custom-types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (lst *List[T]) Push(v T) {
}

// All returns an _iterator_, which in Go is a function
// with a special signature.
// with a [special signature](https://pkg.go.dev/iter#Seq).
func (lst *List[T]) All() iter.Seq[T] {
return func(yield func(T) bool) {
// The iterator function takes another function as
Expand All @@ -57,8 +57,8 @@ func main() {
lst.Push(13)
lst.Push(23)

// Since `List.All` returns an interator, it can be used
// in a regular `range` loop!
// Since `List.All` returns an iterator, we can use it
// in a regular `range` loop.
for e := range lst.All() {
fmt.Println(e)
}
Expand Down
4 changes: 2 additions & 2 deletions examples/range-over-custom-types/range-over-custom-types.hash
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
28edd55763e81476f37e68085f5f79555c15ffe8
Dc3AddmC8Jc
3576a8e614e8e47a0541e800e017d4f9aa2504a3
q2H-p_moUTy
4 changes: 2 additions & 2 deletions public/range-over-custom-types

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4d27fb5

Please sign in to comment.