From ec57a60bebcacf864189f04e538db6eed25e8286 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Thu, 15 Jan 2009 17:54:07 -0800 Subject: casify tutorial examples will bring document in line in a later CL, which may include revisiting some of the names R=rsc DELTA=58 (0 added, 0 deleted, 58 changed) OCL=22906 CL=22908 --- doc/progs/sieve.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc/progs/sieve.go') diff --git a/doc/progs/sieve.go b/doc/progs/sieve.go index 22e14535e..1e472948e 100644 --- a/doc/progs/sieve.go +++ b/doc/progs/sieve.go @@ -5,7 +5,7 @@ package main // Send the sequence 2, 3, 4, ... to channel 'ch'. -func Generate(ch chan int) { +func generate(ch chan int) { for i := 2; ; i++ { ch <- i // Send 'i' to channel 'ch'. } @@ -13,7 +13,7 @@ func Generate(ch chan int) { // Copy the values from channel 'in' to channel 'out', // removing those divisible by 'prime'. -func Filter(in, out chan int, prime int) { +func filter(in, out chan int, prime int) { for { i := <-in; // Receive value of new variable 'i' from 'in'. if i % prime != 0 { @@ -25,12 +25,12 @@ func Filter(in, out chan int, prime int) { // The prime sieve: Daisy-chain Filter processes together. func main() { ch := make(chan int); // Create a new channel. - go Generate(ch); // Start Generate() as a goroutine. + go generate(ch); // Start Generate() as a goroutine. for { prime := <-ch; print(prime, "\n"); ch1 := make(chan int); - go Filter(ch, ch1, prime); + go filter(ch, ch1, prime); ch = ch1 } } -- cgit v1.2.3