| // Copyright 2012 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| func walkImpl(t *tree.Tree, ch chan int) { |
| // Walk walks the tree t sending all values |
| // from the tree to the channel ch. |
| func Walk(t *tree.Tree, ch chan int) { |
| // Need to close the channel here |
| // Same determines whether the trees |
| // t1 and t2 contain the same values. |
| func Same(t1, t2 *tree.Tree) bool { |
| w1, w2 := make(chan int), make(chan int) |
| if v1 != v2 || ok1 != ok2 { |
| fmt.Print("tree.New(1) == tree.New(1): ") |
| if Same(tree.New(1), tree.New(1)) { |
| fmt.Print("tree.New(1) != tree.New(2): ") |
| if !Same(tree.New(1), tree.New(2)) { |