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

tour: let reader know Walk should send in order #202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _content/tour/concurrency.article
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Continue description on [[javascript:click('.next-page')][next page]].

* Exercise: Equivalent Binary Trees

*1.* Implement the `Walk` function.
*1.* Implement the `Walk` function to send all `t` values to `ch` in order.

*2.* Test the `Walk` function.

Expand Down
4 changes: 2 additions & 2 deletions _content/tour/concurrency/exercise-equivalent-binary-trees.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package main

import "golang.org/x/tour/tree"

// Walk walks the tree t sending all values
// from the tree to the channel ch.
// Walk walks the sorted tree t sending all values
// in order from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int)

// Same determines whether the trees
Expand Down
4 changes: 2 additions & 2 deletions _content/tour/solutions/binarytrees.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func walkImpl(t *tree.Tree, ch chan int) {
walkImpl(t.Right, ch)
}

// Walk walks the tree t sending all values
// from the tree to the channel ch.
// Walk walks the sorted tree t sending all values
// in order from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
walkImpl(t, ch)
// Need to close the channel here
Expand Down
4 changes: 2 additions & 2 deletions _content/tour/solutions/binarytrees_quit.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func walkImpl(t *tree.Tree, ch, quit chan int) {
walkImpl(t.Right, ch, quit)
}

// Walk walks the tree t sending all values
// from the tree to the channel ch.
// Walk walks the sorted tree t sending all values
// in order from the tree to the channel ch.
func Walk(t *tree.Tree, ch, quit chan int) {
walkImpl(t, ch, quit)
close(ch)
Expand Down